AEOS Calvarium v0.5

This commit is contained in:
OverSu 2026-08-26 17:23:29 +02:00
commit 1fa8b9e152
177 changed files with 2936 additions and 3386 deletions

View file

@ -1,6 +0,0 @@
Options -Indexes
deny from all
<Files "rew.lib.php">
Allow from all
</Files>

618
lib/aeos.lib.php Executable file → Normal file
View file

@ -2,23 +2,148 @@
// Listings des fonctions (librairie) utilisées sur AEOS
// *****************************************************
//=== Parse Array and translate into XML file [LIB]
class Array2XML {
private static $xml = null;
private static $encoding = 'UTF-8';
public static function init($version = '1.0', $encoding = 'UTF-8', $format_output = true)
{
self::$xml = new DomDocument($version, $encoding);
self::$xml->formatOutput = $format_output;
self::$encoding = $encoding;
}
public static function &createXML($arr=array(), $node_name='NodeNameDefault')
{
$xml = self::getXMLRoot();
if (count($arr) > 1)
{
$xml->appendChild(self::convert($node_name, $arr));
}
else
{
@$root_element = array_pop(array_keys($arr));
$xml->insertBefore(self::convert($root_element, $arr[$root_element]));
}
self::$xml = null;
return $xml;
}
private static function &convert($node_name, $arr=array())
{
$xml = self::getXMLRoot();
$node = $xml->createElement($node_name);
if(is_array($arr))
{
if(isset($arr['@src']))
{
foreach($arr['@src'] as $key => $value)
{
if(!self::isValidTagName($key))
{
throw new Exception('[Array2XML] Illegal character in attribute name. attribute: '.$key.' in node: '.$node_name);
}
$node->setAttribute($key, self::bool2str($value));
}
unset($arr['@src']);
}
if(isset($arr['#text']))
{
foreach($arr as $key => $value)
{
if(@$key[0]=="@") $node->setAttribute(substr($key, 1), $value);
}
if(isset($arr['@cdata']))
{
$node->setAttribute('cdata', $arr['@cdata']);
$node->appendChild($xml->createCDATASection(self::bool2str($arr['#text'])));
}
else
{
$node->appendChild($xml->createTextNode(self::bool2str($arr['#text'])));
}
unset($arr['#text']);
return $node;
}
}
if(is_array($arr))
{
foreach($arr as $key=>$value)
{
if(!self::isValidTagName($key))
{
throw new Exception('[Array2XML] Illegal character in tag name. tag: '.$key.' in node: '.$node_name);
}
if(is_array($value) && is_numeric(key($value)))
{
foreach($value as $k=>$v)
{
$node->appendChild(self::convert($key, $v));
}
}
else
{
$node->appendChild(self::convert($key, $value));
}
unset($arr[$key]);
}
}
if(!is_array($arr))
{
$node->appendChild($xml->createTextNode(self::bool2str($arr)));
}
return $node;
}
private static function getXMLRoot()
{
if(empty(self::$xml))
{
self::init();
}
return self::$xml;
}
private static function bool2str($v)
{
$v = $v === true ? 'true' : $v;
$v = $v === false ? 'false' : $v;
return $v;
}
private static function isValidTagName($tag)
{
$pattern = '/^[a-z_]+[a-z0-9\:\-\.\_]*[^:]*$/i';
return preg_match($pattern, $tag, $matches) && $matches[0] == $tag;
}
}
/* Class qui permet la lecture des fichiers XML */
class Xml2Array
{
private $xml_dom;
private $xml_array;
private $xml;
private $xml;
public function __construct($xml = '') {$this->xml = $xml;}
public function setXml($xml)
{
if(!empty($xml))
{
$this->xml = $xml;
$this->xml = $xml;
}
}
public function get_array()
{
if($this->get_dom() === false){return false;}
@ -27,21 +152,21 @@ class Xml2Array
$this->xml_array[$root_element->tagName] = $this->node_2_array($root_element);
return $this->xml_array;
}
private function node_2_array($dom_element)
{
if($dom_element->nodeType != XML_ELEMENT_NODE){return false;}
$children = $dom_element->childNodes;
foreach($children as $child)
{
if($child->nodeType != XML_ELEMENT_NODE){continue;}
$prefix = ($child->prefix) ? $child->prefix.':' : '';
if(!is_array(@$result[$prefix.$child->nodeName]))
{
$subnode = false;
foreach($children as $test_node)
{
if($child->nodeName == $test_node->nodeName && !$child->isSameNode($test_node))
@ -55,23 +180,23 @@ class Xml2Array
{
$subnode = true;
}
if ($subnode)
{
$result[$prefix.$child->nodeName][] = $this->node_2_array($child);
$result[$prefix.$child->nodeName][] = $this->node_2_array($child);
}
else
{
$result[$prefix.$child->nodeName] = $this->node_2_array($child);
}
}
if (!is_array(@$result))
{
if (function_exists('html_entity_decode')) $result['#text'] = html_entity_decode(htmlentities($dom_element->nodeValue));
else $result['#text'] = htmlentities($dom_element->nodeValue);
if (function_exists('html_entity_decode')) $result['#text'] = html_entity_decode(htmlentities($dom_element->nodeValue));
else $result['#text'] = htmlentities($dom_element->nodeValue);
}
if ($dom_element->hasAttributes())
{
foreach ($dom_element->attributes as $attrib)
@ -81,10 +206,10 @@ class Xml2Array
else $result["@".$prefix.$attrib->nodeName] = htmlentities($attrib->nodeValue);
}
}
return $result;
}
private function get_dom()
{
if(empty($this->xml))
@ -92,25 +217,25 @@ class Xml2Array
echo '<span class="erreur">Aucun fichier XML trouvé.</span>';
return false;
}
$this->xml_dom = @DOMDocument::load($this->xml);
if($this->xml_dom)
{
return $this->xml_dom;
}
echo '<span class="erreur">Données XML invalide</span>';
//header('Location: '.$AEOS_REW.HOME_PAGE.'-E404.html');
}
}
// Renvoi le XML en ARRAY
function lecture_xml($config)
function lecture_xml($config, $isAdmin = FALSE)
{
$converter = new Xml2Array();
$converter->setXml($config);
$xml_array = $converter->get_array();
if($isAdmin) unset($xml_array['configuration']['users']); //if not admin
return $xml_array;
}
@ -119,7 +244,7 @@ function listing_dossier($folder)
{
$dossier = opendir($folder);
$i=0;
while ($Fichier = readdir($dossier))
while ($Fichier = readdir($dossier))
{
if ($Fichier != "." && $Fichier != ".." && $Fichier != ".htaccess" && substr($Fichier, 0, 1) != '.')
{
@ -127,9 +252,14 @@ function listing_dossier($folder)
$i++;
}
}
@natsort($array);
return $array;
closedir($dossier);
if(isset($array))
{
@natsort($array);
return $array;
}
else return FALSE;
}
// Renvoi le listing du dossier PAGE en triant par ordre
@ -137,11 +267,11 @@ function listing_ordre($o = NULL)
{
$a = array();
$l = listing_dossier(DATA_PAGES);
foreach ($l as &$p)
foreach ($l as &$p)
{
$m = lecture_xml(DATA_PAGES.$p);
$a[$m['page']['ordre']['#text']] = $p;
}
}
switch($o)
{
case 1: krsort($a); break;
@ -152,53 +282,48 @@ function listing_ordre($o = NULL)
}
// Enregistre une donnée dans un XML - Chemin, OldElement, NewElement
/*
function ecriture_xml($a, $b, $c)
function ecriture_xml($a, $e)
{
$dom = new DomDocument;
$dom->load($a);
$xml = $dom->getElementsByTagName($b);
//echo $xml->item(0)->nodeValue;
$titre = $xml->item(0);
$titre->nodeValue = stripslashes(utf8_encode($c));
//echo $dom->saveXML();
$dom->save($a);
}
*/
$arrayXML = lecture_xml($a);
$arrayKEY = $e;
$d = false;
foreach($arrayKEY as $arrayOptions => $arrayValues) {
$tmp = &$arrayXML;
function ecriture_xml($a, $b, $c, $d=FALSE)
{
$dom = new DomDocument('1.0','UTF-8');
$dom->load($a);
$b = explode("/", $b);
$i = 0;
foreach($b as $element)
{
$crt = "dom".$i;
$prec = ($i == 0)? "dom" : "dom".($i-1);
if(substr($element, -1) == "]")
foreach(explode('/', $arrayOptions) as $key)
{
$d = explode("[", $element);
$e = $d[0];
$f = intval(substr($d[1], 0, -1));
$$crt = $$prec->getElementsByTagName($e)->item($f);
if(strpos($key, "#CDATA"))
{
$d = true;
$key = explode("#CDATA", $key);
$key = $key[0];
}
$tmp =& $tmp[$key];
}
else
if($d)
{
$$crt = $$prec->getElementsByTagName($element)->item(0);
$tmp["@cdata"] = $arrayValues;
//$tmp["#text"] = "<![CDATA[".$arrayValues."]]>";
}
$i++;
}
$rep = $$crt->nodeValue = stripslashes($c);
if($d)
{
$ocrt = $$crt;
$ncrt=$$crt->parentNode->appendChild($dom->createElement($element));
$cdata=$dom->createCDATASection(stripslashes($c));
$ncrt->appendChild($cdata);
$$crt->parentNode->replaceChild($ncrt, $ocrt);
}
$dom->save($a);
else $tmp["#text"] = $arrayValues;
//$tmp["#text"] = $arrayValues;
}
$savedXML = Array2XML::createXML($arrayXML);
$savedXML->save($a);
}
// Renvoi une donnée en STRING
@ -210,9 +335,69 @@ function donnee_xml($a, $b)
return $xml->item(0)->nodeValue;
}
// Renvoi STRING
// Nettoie le nom d'un fichier
// Thanks to Magento script
function cleanName($a)
{
$b = array('"', '/', ',', '\\', '*', '?', '<', '>', '|', ':');
$array = array(
'&amp;' => 'and', '@' => 'at', '©' => 'c', '®' => 'r', 'À' => 'a',
'Á' => 'a', 'Â' => 'a', 'Ä' => 'a', 'Å' => 'a', 'Æ' => 'ae','Ç' => 'c',
'È' => 'e', 'É' => 'e', 'Ë' => 'e', 'Ì' => 'i', 'Í' => 'i', 'Î' => 'i',
'Ï' => 'i', 'Ò' => 'o', 'Ó' => 'o', 'Ô' => 'o', 'Õ' => 'o', 'Ö' => 'o',
'Ø' => 'o', 'Ù' => 'u', 'Ú' => 'u', 'Û' => 'u', 'Ü' => 'u', 'Ý' => 'y',
'ß' => 'ss','à' => 'a', 'á' => 'a', 'â' => 'a', 'ä' => 'a', 'å' => 'a',
'æ' => 'ae','ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ò' => 'o', 'ó' => 'o',
'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u',
'û' => 'u', 'ü' => 'u', 'ý' => 'y', 'þ' => 'p', 'ÿ' => 'y', 'Ā' => 'a',
'ā' => 'a', 'Ă' => 'a', 'ă' => 'a', 'Ą' => 'a', 'ą' => 'a', 'Ć' => 'c',
'ć' => 'c', 'Ĉ' => 'c', 'ĉ' => 'c', 'Ċ' => 'c', 'ċ' => 'c', 'Č' => 'c',
'č' => 'c', 'Ď' => 'd', 'ď' => 'd', 'Đ' => 'd', 'đ' => 'd', 'Ē' => 'e',
'ē' => 'e', 'Ĕ' => 'e', 'ĕ' => 'e', 'Ė' => 'e', 'ė' => 'e', 'Ę' => 'e',
'ę' => 'e', 'Ě' => 'e', 'ě' => 'e', 'Ĝ' => 'g', 'ĝ' => 'g', 'Ğ' => 'g',
'ğ' => 'g', 'Ġ' => 'g', 'ġ' => 'g', 'Ģ' => 'g', 'ģ' => 'g', 'Ĥ' => 'h',
'ĥ' => 'h', 'Ħ' => 'h', 'ħ' => 'h', 'Ĩ' => 'i', 'ĩ' => 'i', 'Ī' => 'i',
'ī' => 'i', 'Ĭ' => 'i', 'ĭ' => 'i', 'Į' => 'i', 'į' => 'i', 'İ' => 'i',
'ı' => 'i', 'IJ' => 'ij','ij' => 'ij','Ĵ' => 'j', 'ĵ' => 'j', 'Ķ' => 'k',
'ķ' => 'k', 'ĸ' => 'k', 'Ĺ' => 'l', 'ĺ' => 'l', 'Ļ' => 'l', 'ļ' => 'l',
'Ľ' => 'l', 'ľ' => 'l', 'Ŀ' => 'l', 'ŀ' => 'l', 'Ł' => 'l', 'ł' => 'l',
'Ń' => 'n', 'ń' => 'n', 'Ņ' => 'n', 'ņ' => 'n', 'Ň' => 'n', 'ň' => 'n',
'ʼn' => 'n', 'Ŋ' => 'n', 'ŋ' => 'n', 'Ō' => 'o', 'ō' => 'o', 'Ŏ' => 'o',
'ŏ' => 'o', 'Ő' => 'o', 'ő' => 'o', 'Œ' => 'oe','œ' => 'oe','Ŕ' => 'r',
'ŕ' => 'r', 'Ŗ' => 'r', 'ŗ' => 'r', 'Ř' => 'r', 'ř' => 'r', 'Ś' => 's',
'ś' => 's', 'Ŝ' => 's', 'ŝ' => 's', 'Ş' => 's', 'ş' => 's', 'Š' => 's',
'š' => 's', 'Ţ' => 't', 'ţ' => 't', 'Ť' => 't', 'ť' => 't', 'Ŧ' => 't',
'ŧ' => 't', 'Ũ' => 'u', 'ũ' => 'u', 'Ū' => 'u', 'ū' => 'u', 'Ŭ' => 'u',
'ŭ' => 'u', 'Ů' => 'u', 'ů' => 'u', 'Ű' => 'u', 'ű' => 'u', 'Ų' => 'u',
'ų' => 'u', 'Ŵ' => 'w', 'ŵ' => 'w', 'Ŷ' => 'y', 'ŷ' => 'y', 'Ÿ' => 'y',
'Ź' => 'z', 'ź' => 'z', 'Ż' => 'z', 'ż' => 'z', 'Ž' => 'z', 'ž' => 'z',
'ſ' => 'z', 'Ə' => 'e', 'ƒ' => 'f', 'Ơ' => 'o', 'ơ' => 'o', 'Ư' => 'u',
'ư' => 'u', 'Ǎ' => 'a', 'ǎ' => 'a', 'Ǐ' => 'i', 'ǐ' => 'i', 'Ǒ' => 'o',
'ǒ' => 'o', 'Ǔ' => 'u', 'ǔ' => 'u', 'Ǖ' => 'u', 'ǖ' => 'u', 'Ǘ' => 'u',
'ǘ' => 'u', 'Ǚ' => 'u', 'ǚ' => 'u', 'Ǜ' => 'u', 'ǜ' => 'u', 'Ǻ' => 'a',
'ǻ' => 'a', 'Ǽ' => 'ae','ǽ' => 'ae','Ǿ' => 'o', 'ǿ' => 'o', 'ə' => 'e',
'Ё' => 'jo','Є' => 'e', 'І' => 'i', 'Ї' => 'i', 'А' => 'a', 'Б' => 'b',
'В' => 'v', 'Г' => 'g', 'Д' => 'd', 'Е' => 'e', 'Ж' => 'zh','З' => 'z',
'И' => 'i', 'Й' => 'j', 'К' => 'k', 'Л' => 'l', 'М' => 'm', 'Н' => 'n',
'О' => 'o', 'П' => 'p', 'Р' => 'r', 'С' => 's', 'Т' => 't', 'У' => 'u',
'Ф' => 'f', 'Х' => 'h', 'Ц' => 'c', 'Ч' => 'ch','Ш' => 'sh','Щ' => 'sch',
'Ъ' => '-', 'Ы' => 'y', 'Ь' => '-', 'Э' => 'je','Ю' => 'ju','Я' => 'ja',
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e',
'ж' => 'zh','з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l',
'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's',
'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch',
'ш' => 'sh','щ' => 'sch','ъ' => '-','ы' => 'y', 'ь' => '-', 'э' => 'je',
'ю' => 'ju','я' => 'ja','ё' => 'jo','є' => 'e', 'і' => 'i', 'ї' => 'i',
'Ґ' => 'g', 'ґ' => 'g', 'א' => 'a', 'ב' => 'b', 'ג' => 'g', 'ד' => 'd',
'ה' => 'h', 'ו' => 'v', 'ז' => 'z', 'ח' => 'h', 'ט' => 't', 'י' => 'i',
'ך' => 'k', 'כ' => 'k', 'ל' => 'l', 'ם' => 'm', 'מ' => 'm', 'ן' => 'n',
'נ' => 'n', 'ס' => 's', 'ע' => 'e', 'ף' => 'p', 'פ' => 'p', 'ץ' => 'C',
'צ' => 'c', 'ק' => 'q', 'ר' => 'r', 'ש' => 'w', 'ת' => 't', '™' => 'tm',
);
$a = strtr($a, $array);
$a = preg_replace('/[^a-z0-9\._-]+/i', '-', strtolower($a));
$b = array('\'', '"', '/', ',', '\\', '*', '?', '<', '>', '|', ':');
$c = str_replace($b, "", $a);
return utf8_decode($c);
}
@ -227,6 +412,7 @@ function upload_unzip($fichier, $dossier, $page)
if ($type=="application/zip" || $type=="application/x-zip-compressed" || $type=="multipart/x-zip" || $type=="application/x-compressed" || $type=="application/octet-stream")
{
$target_path = $dossier.$filename;
//echo $target_path;
if(move_uploaded_file($source, $target_path))
{
$nom = basename($filename, ".zip");
@ -239,7 +425,7 @@ function upload_unzip($fichier, $dossier, $page)
{
$zip = new ZipArchive();
$x = $zip->open($target_path);
if ($x === true)
if ($x === true)
{
$zip->extractTo($dossier.$nom);
$zip->close();
@ -251,7 +437,7 @@ function upload_unzip($fichier, $dossier, $page)
//
$e = 0; //echo "<span class='valide'>Votre ".$page." a bien &eacute;t&eacute; install&eacute;.</span>";
}
}
}
else {$e=1;
//echo "<span class='erreur'>Une erreur est survenue. Veuillez recommencer.</span>";
}
@ -270,12 +456,12 @@ function br2nl($replace) {
//Merci à holger1 de php.net
// Supprime un dossier
function removeFolder($dir) {
if (is_dir($dir))
if (is_dir($dir))
{
$objects = scandir($dir);
foreach ($objects as $object)
foreach ($objects as $object)
{
if ($object != "." && $object != "..")
if ($object != "." && $object != "..")
{
if (filetype($dir."/".$object) == "dir") removeFolder($dir."/".$object); else unlink($dir."/".$object);
}
@ -283,9 +469,9 @@ function removeFolder($dir) {
reset($objects);
rmdir($dir);
}
}
}
// Vide un dossier
// Vide un dossier
function clearFolder($folder)
{
$dossier=opendir($folder);
@ -299,19 +485,18 @@ function clearFolder($folder)
}
closedir($dossier);
}
// Génère un mot de passe de $nbr caractères
function generer_mdp($nbr)
//=== Generate a simple password
//=== IN: Number of character [INT FORMAT]
//=== OUT: Generated password [STRING FORMAT]
//=== VAR: $N number of characters wanted
function generateEasyPassword($N)
{
$str = "";
$chaine = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$S = "";
$C = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
srand((double)microtime()*1000);
for($i=0; $i<$nbr; $i++) {
$str .= $chaine[rand()%strlen($chaine)];
}
return $str;
for($i=0; $i<$N; $i++) {$S .= $C[rand()%strlen($C)];}
return $S;
}
// Envoi un mail
@ -326,13 +511,13 @@ function sendMail($expediteur, $destinataire, $titre, $messageHTML, $name = null
mail($destinataire, $titre, $messageHTML, $entete);
}
// Retourne un boolean
// Retourne un boolean
// Vérifie si une adresse est belle et bien au format mail.
function checkMail($adresse)
{
$Syntaxe='#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,6}$#';
if(preg_match($Syntaxe,$adresse)) return true;
else return false;
{
$Syntaxe='#^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,6}$#';
if(preg_match($Syntaxe,$adresse)) return true;
else return false;
}
// Retourne STRING
@ -341,13 +526,13 @@ function getBaseScript()
{
$fullPath = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
$file = basename ($fullPath);
$dir = dirname($fullPath);
$dir = dirname($fullPath);
return $dir;
}
// Retourne STRING
// Transforme une chaine en URL valide
function valideURL($s)
function valideURL($s)
{
$p = array("?","!","@","#","%","&amp;","*","(",")","[","]","=","+"," ",";",":","'",".","_", "&");
$s = str_replace($p, "-", $s);
@ -368,40 +553,33 @@ function getValueArray($a, $b, $c)
return $v[$k[$b]+$c];
}
function showTooltip($a, $b)
{
$r='<a href="#" class="tooltip">';
$r.=$a;
$r.='<span>';
$r.='<img class="tooltipi" src="../themes/system/images/icones/tooltip.png" />';
$r.=$b;
$r.='</span>';
$r.='</a>';
return $r;
}
// Retourne BOOLEAN
// Retourne si il y a une nouvelle version - ou pas.
// Fonction non...fonctionnelle !
function checkVersion()
{
$v = lecture_xml(AEOS_REAL_URL.'/demo/data/config.xml');
if($v['configuration']['version']['#text']==AEOS_VERSION) return FALSE;
$v = file_get_contents(AEOS_REAL_URL.'/demo/data/config.xml');
if($v['configuration']['update']['#text']==AEOS_VERSION) return FALSE;
else return TRUE;
}
// Retourne STRING
// Retourne STRING sécurisé
function CA20($a)
{
//XSS
strip_tags($a);
$a = strip_tags($a);
$a = htmlspecialchars($a, ENT_QUOTES);
//SQL Injection
$a = htmlentities($a, ENT_QUOTES);
if(get_magic_quotes_gpc()===1){$a = stripslashes($a);}
$a = stripslashes($a);
//Remove tabs
//$a = trim(preg_replace('/\t+/', '', $a));
return $a;
}
@ -410,12 +588,222 @@ function checkInstall()
global $subdir;
$config = $subdir."data/config.xml";
$install = $subdir."install/index.php";
if (!file_exists($config))
if (!file_exists($config))
{
if (!file_exists($install)) die("Fichier config.xml et script d'installation introuvable");
else header('Location: '.$install);
}
return TRUE;
}
// Retourne STRING
// Renvoi la valeur LANGUAGE du navigateur web sous forme "fr"
function detectLang()
{
if(isset($_['lang'])) $l = $_['lang'];
else
{
$l = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$l = strtolower(substr(chop($l[0]),0,2));
switch ($l)
{
case 'fr': $l = "fr_FR"; break;
case 'en': $l = "en_US"; break;
default: $l = "fr_FR"; break;
}
}
return $l;
}
// Retourne BOOLEAN
// Vérifie si un champs est vide
function checkEmptyField($a)
{
if (empty($a) || $a=="") return TRUE;
else return FALSE;
}
// Retourne BOOLEAN
// Vérifie si un fichier lang.php est disponible pour le module $a
function checkMultilangModuleAvailable($a)
{
if(isset($a)) if($a==1) return TRUE;
else return FALSE;
}
//Retourne STRING
// Change un paramètre dans l'URL via STRING_QUERY
function changeParameterRequestURL($a, $b)
{
parse_str($a, $d);
foreach($b as $k => $v)
{
$d[$k] = $v;
}
$d = http_build_query($d);
return $d;
}
// Retourne HTML
// Affiche une notification
function showNotification($a, $b, $c = false)
{
$r = "<div class='notification ".$b."'><p>";
if($c) $r.="<i class='".$c."'></i> ";
$r.= $a."</p></div>";
return $r;
}
//=== Ajoute les fichiers necessaires (modules/plugins) dans les endroits appropriés (JS en bas de page et le reste dans le head)
function checkFiles($b, $f, $s = FALSE, $g = FALSE)
{
$b = explode('/', $b);
$d = listing_dossier($s.'plugins');
if(!$d) $d=Array();
$toInclude = array(
"Modules" =>
Array(
"modules",
Array(
$b[0]
),
),
"Themes" =>
Array(
"themes",
Array(
$b[1]
),
),
"Plugins" =>
Array(
"plugins",
$d,
),
);
// if admin, do not load MODULES/THEMES
if($s) unset($toInclude['Modules']);
if($s) unset($toInclude['Themes']);
$return = '';
$returnedPosition = Array();
$returnedOB = Array();
foreach($toInclude as $k => $v)
{
foreach($v[1] as $v1k => $v1v)
{
$a = lecture_xml($s.$v[0].'/'.$v1v.'/config.xml');
// if only one file
if(!isset($a['configuration']['fichiers']['fichier'][0]) && isset($a['configuration']['fichiers']['fichier']))
{
$tmp = $a['configuration']['fichiers']['fichier'];
unset($a['configuration']['fichiers']['fichier']);
$a['configuration']['fichiers']['fichier'][0] = $tmp;
}
$nbr = @count($a['configuration']['fichiers']['fichier']);
$activation = @$a['configuration']['activation']['#text'];
// if admin and plugin not activate
if(($s && @$a['configuration']['edition']['admin']['#text']=="TRUE") || !$s)
{
if((!isset($activation) || $activation==1) && $nbr>0)
{
$c = '<!-- '.$k.'/'.$v1v.' -->'."\r\n\t";
if(isset($a['configuration']['fichiers']))
{
for($i=0; $i<$nbr; $i++)
{
$src = $a['configuration']['fichiers']['fichier'][$i]['#text'];
$type = $a['configuration']['fichiers']['fichier'][$i]['@type'];
$script = $a['configuration']['fichiers']['fichier'][$i]['@script'];
if($f==0)
{
switch($type)
{
case 'css':
if($script=="interne") $c .= '<link rel="stylesheet" type="text/css" media="screen" href="'.$s.$v[0].'/'.$v1v.'/css/'.$src.'" />'."\r\n\t";
else if($script=="externe") $c .= '<link rel="stylesheet" type="text/css" media="screen" href="'.$src.'" />'."\r\n\t";
else if($script=="code") $c .= '<style type="text/css">'.$src.'</style>'."\r\n\t";
break;
}
}
elseif($f==1)
{
switch($type)
{
case 'php':
if($script=="interne")
{
ob_start();
include($s.$v[0].'/'.$v1v.'/inc/'.$src);
$returnedPosition[] = $a['configuration']['edition']['position']['#text'];
$returnedOB[] = ob_get_clean();
}
break;
}
}
elseif($f==2)
{
switch($type)
{
case 'js':
if($script=="interne") $c .= '<script src="'.$s.$v[0].'/'.$v1v.'/js/'.$src.'"></script>'."\r\n\t";
else if($script=="externe") $c .= '<script src="'.$src.'"></script>'."\r\n\t";
else if($script=="code") $c .= '<script type="text/javascript">'.$src.'</script>'."\r\n\t";
break;
}
}
}
}
$return .= $c;
}
}
}
}
return Array("Data" => $return, "OB" => @$returnedOB, "Position" => @$returnedPosition);
}
// Generate all HTML and modify in order to add PHP file via plugins
function insertPlugins($e, $r)
{
// DOM
$dom = new DOMDocument();
$domRedefined = new DOMDocument;
@$dom->loadHtml(utf8_decode($e));
// Remove the DOCTYPE and HTML tag previously generated
$body = $dom->getElementsByTagName('html')->item(0);
foreach ($body->childNodes as $child){
$domRedefined->appendChild($domRedefined->importNode($child, true));
}
for($i=0; $i<count($r['OB']);$i++)
{
$a = 'var'.$i;
// Find Position to insert
$$a = $dom->getElementById($r["Position"][$i]);
// Prepare the HTML to insert
$f = $domRedefined->createDocumentFragment();
$f->appendXML($r["OB"][$i]);
$$a = $domRedefined->getElementById($r["Position"][$i]);
$$a->parentNode->insertBefore($f, $$a);
}
return $domRedefined->saveHTML();
}
?>

30
lib/config.lib.php Executable file → Normal file
View file

@ -1,21 +1,22 @@
<?php
/* ***************************************************
Listings des variables les plus utilisées sous AEOS.
Listings des variables les plus utilis<EFBFBD>es sous AEOS.
****************************************************/
header("Content-Type: text/html; charset=UTF-8");
header("Content-Type: text/html; charset=UTF-8");
date_default_timezone_set("Europe/Paris");
//Check Admin
if (preg_match("/admin/", $_SERVER['SCRIPT_FILENAME']) || preg_match("/install/", $_SERVER['SCRIPT_FILENAME']))
{
$isAdmin = true;
$subdir = "../";
//Sécurisation
foreach ($_GET as $a => $b){$_[$a] = $b;}
foreach ($_POST as $a => $b){$_[$a] = $b;}
}
else
{
$isAdmin = false;
$subdir = "";
//Sécurisation
foreach ($_GET as $a => $b){$_[$a] = CA20($b);}
foreach ($_POST as $a => $b){$_[$a] = CA20($b);}
}
@ -40,14 +41,25 @@ for($i=0; $i<$nbPages; ++$i)
$ordre_pages[$lecture_tmp['page']['ordre']['#text']] = $listing_pages[$i];
}
// Lecture des utilisateurs si Admin
if($isAdmin) $config = lecture_xml($subdir.'data/config.xml');
else $config = lecture_xml($subdir.'data/config.xml', TRUE);
// 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');
// Lecture des fichiers optionnels des modules
$configModule = lecture_xml($subdir.'modules/'.$page['page']['type']['#text'].'/config.xml');
// Langue
require_once($subdir.'lang/'.detectLang().".php");
//require_once($subdir.'lang/'.AEOS_LANG.".php");
// Admin
if (isset($_['pid'])) $pid=$_['pid']; else $pid = 1;
if (isset($_['sid'])) $sid=$_['sid']; else $sid = 1;
?>
$admin_url = '';
if (isset($_['tab'])) $tab=$_['tab']; else $tab = "dashboard";
$admin_url .= 'tab='.$tab;
if (isset($_['opt'])) {$opt=$_['opt']; $admin_url .= '&opt='.$opt;} else $opt = NULL;
?>

30
lib/debug.lib.php Executable file → Normal file
View file

@ -3,15 +3,25 @@
// *****************************************************
ini_set('display_errors', 1);
ini_set('log_errors', 1);
// Retourne STRING
// Retourne sous forme d'arbre l'Array
if (!function_exists("view"))
{
function view($a)
{
print_r('<pre>');
print_r($a);
print_r('</pre>');
}
//=== Show an array with pre tag
//=== IN: A for what to show [ARRAY FORMAT]
//=== OUT: None [ECHO]
function view($a)
{
print_r("<pre>");
print_r($a);
print_r("</pre>");
}
function debug() {
$trace = debug_backtrace();
$rootPath = dirname(dirname(__FILE__));
$file = str_replace($rootPath, '', $trace[0]['file']);
$line = $trace[0]['line'];
$var = $trace[0]['args'][0];
$lineInfo = sprintf('<div><strong>%s</strong> (line <strong>%s</strong>)</div>', $file, $line);
$debugInfo = sprintf('<pre>%s</pre>', print_r($var, true));
print_r($lineInfo.$debugInfo);
}
?>

0
lib/index.html Executable file → Normal file
View file

53
lib/var.lib.php Executable file → Normal file
View file

@ -1,46 +1,63 @@
<?php
/*
Fichier libraire contenant toutes les constantes et/ou variables
permettant de gérer AEOS.
permettant de g<EFBFBD>rer AEOS.
*/
define('EXEC_START_TIME', microtime(true));
define('SECURITY', FALSE);
// Variables utilisées fréquemments
// Variables utilis<69>es fr<66>quemments
define('AEOS_NAME', $config['configuration']['nom_site']['#text']);
define('AEOS_DESC', $config['configuration']['description_site']['#text']);
define('AEOS_THEME', $config['configuration']['theme']['#text']);
define('AEOS_MAINTENANCE', $config['configuration']['maintenance']['#text']);
define('AEOS_MAINTMSG', $config['configuration']['message']['#text']);
define('AEOS_MODULE', $configModule['configuration']['dossier']['#text']);
define('AEOS_MAINTENANCE', $config['configuration']['maintenanceMode']['#text']==='TRUE'?TRUE:FALSE);
define('AEOS_MAINTMSG', $config['configuration']['maintenanceMessage']['#text']);
define('AEOS_FOOTER', $config['configuration']['footer']['#text']);
// Permet le référencement
// Permet le référencement
define('AEOS_TITLE', $page['page']['nom']['#text']);
// Information administration
define('AEOS_PASSWORD', $config['configuration']['mdp_admin']['#text']);
define('AEOS_LOGIN', $config['configuration']['login_admin']['#text']);
define('AEOS_MAIL', $config['configuration']['email_admin']['#text']);
if($isAdmin && isset($_SESSION['_LOGIN']))
{
//define('AEOS_PASSWORD', $_SESSION['password']);
define('AEOS_LOGIN', $_SESSION['_LOGIN']);
define('AEOS_MAIL', $config['configuration']['users'][$_SESSION['_LOGIN']]['email']['#text']);
if(!isset($config['configuration']['users'][$_SESSION['_LOGIN']]['avatar']['#text']) || $config['configuration']['users'][$_SESSION['_LOGIN']]['avatar']['#text']=="")
define('AEOS_AVATAR', "themes/system/images/avatar.png");
else
define('AEOS_AVATAR', $config['configuration']['users'][$_SESSION['_LOGIN']]['avatar']['#text']);
define('AEOS_FIRSTNAME', $config['configuration']['users'][$_SESSION['_LOGIN']]['firstname']['#text']);
define('AEOS_LASTNAME', $config['configuration']['users'][$_SESSION['_LOGIN']]['lastname']['#text']);
define('AEOS_ROLE', $config['configuration']['users'][$_SESSION['_LOGIN']]['role']['#text']);
define('AEOS_USER_LANG', $config['configuration']['users'][$_SESSION['_LOGIN']]['language']['#text']);
define('AEOS_LANG', $config['configuration']['lang']['#text']);
}
// Variable d'URL Rewriting
define('AEOS_URL', $_SERVER['SERVER_NAME']);
define('AEOS_LANG', $config['configuration']['lang']['#text']);
//define('AEOS_LANG', $config['configuration']['lang']['#text']);
define('AEOS_VERSION', $config['configuration']['version']['#text']);
define('AEOS_BRANCH', $config['configuration']['branch']['#text']);
define('AEOS_CODENAME', $config['configuration']['codename']['#text']);
define('AEOS_UPDATE', $config['configuration']['update']['#text']);
define('AEOS_PATH', dirname($_SERVER["REQUEST_URI"]));
define('AEOS_REW', $config['configuration']['urlrewriting_key']['#text']);
define('AEOS_REWMODE', $config['configuration']['urlrewriting']['#text']==='TRUE'?TRUE:FALSE);
define('AEOS_REWKEY', $config['configuration']['urlrewriting_key']['#text']);
define('HOME_PAGE', $config['configuration']['accueil']['#text']);
define('DATA_PAGES', $subdir.'data/pages/');
define('DATA_TRASH', $subdir.'data/corbeille/');
define('LAST_KEY', max(array_keys($lecture_pages))+1);
define('LAST_ORDER', max(array_keys($ordre_pages))+1);
define('DEBUG_MODE', $config['configuration']['debug']['#text']==='TRUE'?TRUE:FALSE);
define('DEBUG_MODE', $config['configuration']['debugMode']['#text']==='TRUE'?TRUE:FALSE);
('DEBUG_MODE')?include($subdir.'lib/debug.lib.php'):FALSE;
define('UPDATE', $config['configuration']['update']['#text']);
define('AEOS_REAL_URL', 'http://nnsprod.com/aeos');
define('AEOS_REAL_URL', 'https://nnsprod.com/aeos');
define('URL_CHECK_UPDATE', AEOS_REAL_URL.'/update/notifications.xml');
//Admin
define('ADMIN_REQUEST_URL', 'index.php?pid='.$pid.'&sid='.$sid);
//define('ADMIN_REQUEST_URL', 'index.php?'.$_SERVER["QUERY_STRING"]);
define('ADMIN_REQUEST_URL', 'index.php?'.$admin_url);
$DATA_PAGES = $data_pages;
unset($page);
?>
?>

22
lib/wysiwyg.lib.php Executable file → Normal file
View file

@ -1,6 +1,24 @@
<?php
// Script owEditor
// Script owEditor/pell
if (isset($_['input']))
{
$currentContent=stripslashes($_['input']);
}
else
{
$currentContent=@$page['page']['contenu']['#text'];
}
?>
<script type="text/javascript">
new owEditor({fullPanel : true, maxHeight : 230, maxWidth : 700}).panelInstance('input');
var editor = window.pell.init({
element: document.getElementById('editor'),
defaultParagraphSeparator: 'p',
onChange: function (html) {
document.getElementById('html-output').textContent = html
},
})
document.getElementById("pell-id").innerHTML = `<?php echo $currentContent; ?>`;
</script>