load(APPSDIR.$application.'/property.xml'); } if ($applicationXML->documentElement->getAttribute('active') && ($applicationXML->getElementsByTagName('application') || $applicationXML->getElementsByTagName('page'))) { foreach($applicationXML->getElementsByTagName('security') as $security) { //Autorisation par défaut if ($security->getAttribute('default') == "connected") $autoriser = !empty($SESS->values["connecte"]); elseif ($security->getAttribute('default') == "authorized") $autoriser = true; //Méthode(s) d'autorisation(s) if (ereg("users", $security->getAttribute('type')) && !empty($SESS->values["username"])) { foreach($applicationXML->getElementsByTagName('user') as $user) { if (strtolower($user->textContent) == strtolower($SESS->values["id_user"])) return !$autoriser; } } if (ereg("usernames", $security->getAttribute('type')) && !empty($SESS->values["username"])) { foreach($applicationXML->getElementsByTagName('username') as $user) { if (strtolower($user->textContent) == strtolower($SESS->values["username"])) return !$autoriser; } } if (ereg("ips", $security->getAttribute('type'))) { foreach($applicationXML->getElementsByTagName('ip') as $ip) { if ($ip->textContent == $_SERVER["REMOTE_ADDR"]) return !$autoriser; } } } } return $autoriser; } function send404(&$xml_root) { global $xml; $xml_root->appendChild($xml->createElement("titre", "404.png")); $xml_root->appendChild($xml->createElement("body", "Page introuvable")); } function send403(&$xml_root) { global $xml; $xml_root->appendChild($xml->createElement("titre", "avertissements.png")); $xml_root->appendChild($xml->createElement("body", "