diff --git a/admin.php b/admin.php
index 0b8346f..b3d9bbc 100644
--- a/admin.php
+++ b/admin.php
@@ -1,176 +1 @@
connect ( $_SESSION ['session_mdp'] );
-if ($me->isAdminLevelLowerThan ( 15 )) {
- header ( 'Location:401.php' );
- exit ();
-}
-?>
-
-
-
-
-
-La console d'admin
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Hello !!!
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/admindialog.php b/admindialog.php
index 0aa78dd..e427a0b 100644
--- a/admindialog.php
+++ b/admindialog.php
@@ -1,224 +1,52 @@
connect();
-if($me->isAdminLevelLowerThan(15)){
+if($me->getAdminLevel()<15){
echo 'Your admin level is too low (15 or more required)';
exit;
-}elseif(!isset($_POST['command'])){
- echo 'Please set an command in the URL (POST method ,name:"command")';
- exit;
-}
-*/
-function isAlphaNumeric($char){
- return isAlphabetic($char) or isNumeric($char);
-}
-function isAlphabetic($char){
- return preg_match('#^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]$#',$char) === 1;
-}
-function isNumeric($char){
- return preg_match('#^[0123456789]$#',$char) === 1;
-}
-
-function error($pos,$reason){
- echo 'Error at char '.$pos.' : '.$reason;
+}elseif(!isset($_GET['action'])){
+ echo 'Please set an action in the URL (GET method ,name:"action")';
exit;
}
-function readAlphabetic($command){
- global $pos;
- $out = "";
- while (isAlphaNumeric($command[$pos])) {
- $out .= $command[$pos];
- $pos+=1;
+switch ($_GET['action']){
+
+case 'set_discutionVisibility' :
+ if(!isset($_POST['discutionVisibility'])){
+ echo 'You must give a discution visibility (POST method,name:"discutionVisibility")';
+ exit;
}
- return $out;
-}
-
-function readNumeric($command){
- //TODO Add non-integer support (virgule , puissance , autres bases ...)
- global $pos;
- $out = "";
- while (isNumeric($command[$pos])) {
- $out .= $command[$pos];
- $pos+=1;
+ if(!isset($_POST['discutionID'])){
+ echo 'You must give a discution ID (POST method,name:"discutionID")';
+ exit;
}
- return intval($out);
-}
-
-function readString($command,$startChar='\"'){
- global $pos;
- $out = "";
- $startChar = $command[$pos];
- $pos+=1;
- while (TRUE) {
- $char = $command[$pos];
- if($char === $startChar)
- break;
- if($char === '\\'){
- $pos+=1;
- switch ($command[$pos]){
- case '\\':
- $char = '\\';
- break;
- case $startChar:
- $char = $startChar;
- break;
- default:
- error($pos,'Unexpected "'.$command['pos'].'" after "\\"');
- }
- }
- $out .= $char;
- $pos+=1;
- }
- $pos +=1;
- return $out;
-}
-
-$operators = array('=','!=','>','<','>=','=>','<=','=<','&has;','&nhas;');
-$operatorsChars = array('=','!','<','>','&');
-
-function readOperator($command,$endChar = 'abcdefghijklmnopqrstuvwxytABCDEFGHIJKLMNOPQRSTUVWZYZ0123456789"\''){
- global $pos,$operators;
- if($command[$pos] === '&'){
- $pos+=1;
- $inOperator = readAlphabetic($command);
- if($command[$pos] !== ';'){
- error($pos, 'Unexepted character at the end of the operator ' . $inOperator);
- }
- return '&'.$inOperator.';';
- }
- $reading = '';
- $lastOperator = '';
- $maxPos=min(strlen($command),$pos+5);
- $tPos = $pos;
- while ($tPos<$maxPos) {
- $reading .= $command[$pos];
- $tPos+=1;
- if(in_array($reading,$operators,TRUE))
- $lastOperator=$reading;
- }
- $pos += strLen($lastOperator);
- if(!in_array($lastOperator,$operators))
- error($pos, 'Unknown operator : '.$out);
- return $lastOperator;
-}
-
-function readSelector($command){
- global $pos,$operatorsChars;
- $out = array();
- $pos += 1;//@
- if(!isAlphabetic($command[$pos]))
- error($pos,'Unexepted non-alphabetic char "'.$command[$pos].'" after @');
- $className = readAlphabetic($command,'[');
- $pos += 1;//[ +1
- $attributes = array();
- while($command[$pos] !== ']'){
- if($command[$pos] === ',')
- $pos+=1;
- $attributeName = readAlphabetic($command,implode($operatorsChars));
- $operator = readOperator($command);
- $data = null;
- $type = $command[$pos];
- if(isAlphabetic($type)){
- $data = array('a',readAlphabetic($command));
- }elseif (isNumeric($type)){
- $data = array('0',readNumeric($command));
- }elseif ($type === '"' or $type === '\''){
- $data = array('\"',readString($command));
- }elseif ($type === "@"){
- $data = array('@',readSelector($command));
- }
- $attribute = array();
- $attribute[0] = $attributeName;
- $attribute[1] = $operator;
- $attribute[2] = $data;
- $attributes[] = $attribute;
- }
- $pos+=1;//after "["
- if($command[$pos] == ':'){
- $pos+=1;//letter after ":"
- $selectedAttribute = readAlphabetic($command);
- return array($className,$attributes,$selectedAttribute);
- }
- return array($className,$attributes);
-}
-
-
-$command=$_POST['command'].' ';
-$nommes=array();
-$pos=0;
-while ($pos';
-print_r($nommes);
-echo '';
-
-function exception($reason){
- echo 'An exception occurred : '.$reason;
- exit;
-}
-
-if($nommes[0][0] == 'a'){
- //Command
- $fonction = strtoupper($nommes[0][1]);
- switch ($fonction){
- case 'SET':
- if(count($nommes) !== 42)
- exception('La fonction n\'a pas recu le bon nombre d\'arguments (42)');
- if($nommes[1][0] !== '@')
- exception('Le deuxième argument doit etre un selecteur');
- switch ($nommes[1][0][0]){
- case 'Membre':
- break;
- case 'Projet':
- break;
- case 'Membre':
- break;
- case 'Projet':
- break;
- case 'Membre':
- break;
- default:
- exception('Unknown selector class :'.$nommes[1][0][0]);
- }
-
- case 'DELETE':
-
- default:
- exception('Unknown function '.$fonction);
-
+ $discutionVisibility = $_POST['discutionVisibility'];
+ $discutionID = $_POST['discutionID'];
+ if ($discutionVisibility !== 'p' and preg_match ( "#^a[0-9]+$#",$discutionVisibility ) != 1 and preg_match ( '#^x([0-9]+;)*([0-9]+)?$#', $discutionVisibility ) != 1 ){
+ echo 'Your discution visibility is not well-formed : it should have been formed like ("p" or "x31;41;59;26;53" or "a42")';
+ exit;
}
-}
+ $req = $GLOBALS['bdd']->prepare('UPDATE discussions SET autorized=? WHERE ID=?');
+ $req->execute(array($discutionVisibility,$discution));
+
+
+
+
+
+
+
+ exit;
+
+
+default :
+ echo 'Unknown action : '+$_GET['action'];
+ exit;
+
+}
\ No newline at end of file
diff --git a/clazz/Discussion.class.php b/clazz/Discussion.class.php
new file mode 100644
index 0000000..fbd9b8c
--- /dev/null
+++ b/clazz/Discussion.class.php
@@ -0,0 +1,199 @@
+ID = $ID;
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE ID=?');
+ $req->execute(array($ID));
+ if($rep = $req->fetch()){
+ $this->valid = TRUE;
+ $this->name = $rep['name'];
+ $this->creatorID = new Membre($rep['creatorID']);
+ $this->dateCreation = $rep['dateCreation'];
+ $this->accessibility = $rep['accessibility'];
+ }else{
+ $this->valid = FALSE;
+ }
+ }
+
+ public function exists(){
+ return $this->valid;
+ }
+
+ public function __toString(){
+ $out = 'Discussion\n';
+ $out .= '\tID:' . $this->ID . '\n';
+ $out .= '\tName:' . $this->name . '\n';
+ $out .= '\tCreator:{' . substr(str_replace('\n\t',';',$this->creator->__toString()),0,-1) . '}\n';
+ $out .= '\tDate of creation:' . $this->dateCreation . '\n';
+ $out .= '\tAccessibility:' . $this->accessibility . '\n';
+ return out;
+ }
+
+ //Getters
+ public function getID(){
+ return $this->ID;
+ }
+
+ public function getName(){
+ return $this->name;
+ }
+
+ public function getCreator(){
+ return $creator;
+ }
+
+ public function getDateCreation(){
+ return $this->dateCreation;
+ }
+
+ public function getAccessibility(){
+ return $this->accessibility;
+ }
+
+
+ //Useful Getters
+ public function canAccess($membre){
+ $out = $this->accessibility === 'p';
+ $out = $out or $membre->getID() === $this->creator->getID();
+ if(preg_match ( "#^a[0-9]+$#", $this->accessibility ) == 1)
+ $out = $out or intval ( substr ( $this->accessibility, 1 ) ) <= $membre->getAdminLevel();
+ $out = $out or preg_match ( '#^x([0-9]+;)*' . $membre->getID() . '(;[0-9]+)*$#', $disc ['autorized'] ) == 1;
+ $out = $out or $membre->getAdminLevel() >= 14;
+ return $out;
+ }
+
+
+ //Setters
+ public function rename($newName){
+ if(!exists())
+ return NULL;
+ if(getFromName($newName))
+ return Discussion::NAME_ALREADY_USED;
+ if(strlen($newName)>255)
+ return Discussion::TOO_LONG_NAME;
+ $regex = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.
+ 'éèàµ_\\-\'()\\[\\]\\\\/,;:.§!ù%£$¤=+\\-*\\#~"|ç@';
+ $regex = '#^['.$regex.']+$#';
+ if(preg_match($regex,$newName) != 1)
+ return Discussion::ILLEGAL_NAME;
+ $req->$GLOBALS['bdd']->prepare('UPDATE discussions SET name=? WHERE ID=?');
+ $req->execute(array($newName,$this->ID));
+ return Discussion::NAME_CHANGED;
+ }
+
+ public function changeAccessibility($newAccessibility){
+ if(!exists())
+ return NULL;
+ if($newAccessibility !== 'p' and
+ preg_match('#x([0-9]+;)*[0-9]+#',$newAccessibility) != 1 and
+ preg_match('#a[0-9]+#',$newAccessibility) != 1)
+ return Discussion::MALFORMED_ACCESIBILITY;
+ $req = $GLOBALS['bdd']->prepare('UPDATE discussions SET accessibility=? WHERE ID=?');
+ $req->execute(array($newAccessibility,$this->ID));
+ return Discussion::ACCESSIBILITY_CHANGED;
+ }
+
+ public function setDateCreation($newDateCreation){
+ if (preg_match("/^(\d{4})-(\d{2})-(\d{2}) ([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/", $date, $matches) != 1)
+ return Discussion::MALFORMED_DATE;
+ if (!checkdate($matches[2], $matches[3], $matches[1]))
+ return Discussion::MALFORMED_DATE;
+ $req = $GLOBALS['bdd']->prepare('UPDATE discussions SET dateCreation=? WHERE ID=?');
+ $req->execute(array($newDateCreation,$this->ID));
+ return Discussion::DATE_CREATION_CHANGED;
+ }
+
+ //Discussions getters
+ private static function discussionGetterOutput($req){
+ $out = array();
+ while($rep = $req->fetch())
+ $out[] = new Discussion($rep['ID']);
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+ }
+
+ public static function getFromName($name){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE name=?');
+ $req->execute(array($name));
+ return discussionGetterOutput($req);
+ }
+
+ public static function getFromCreator($creator){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
+ $req->execute(array($creator->getID()));
+ return discussionGetterOutput($req);
+ }
+
+ public static function getFromDateCreation($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation=?');
+ $req->execute(array($date));
+ return discussionGetterOutput($req);
+ }
+
+ public static function getFromAccessibility($accessibility){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
+ $req->execute(array($accessibility));
+ return discussionGetterOutput($req);
+ }
+
+ public static function getCreatedLaterThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation>?');
+ $req->execute(array($date));
+ return discussionGetterOutput($req);
+ }
+
+ public static function getCreatedEarlierThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation');
+ $req->execute(array($date));
+ return discussionGetterOutput($req);
+ }
+
+ public static function getWhichHeCanAccess($he){
+ //TODO utiliser une regex dans la requete SQL pour selectionner les discussions autorisées
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions');
+ $req->execute(array());
+ $out = array();
+ while ( $rep = $req->fetch()) {
+ $disc = new Discussion($rep['ID']);
+ if ($disc->canAccess($membre))
+ $out[] = $disc;
+ }
+ if($out)
+ return $out;
+ else
+ return NULL;
+ }
+
+ // Exceptions texts
+
+ //rename()
+ const NAME_ALREADY_USED = 'Nom déjà utilisé';
+ const ILLEGAL_NAME = 'Le nom de la discussion est incorrect : les caractères autorisés sont :'.
+ '
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.
+ 'éèàμ_-\'()[\\]\\\\/,;:.§!ù%£$¤=+-*\\#~"|ç@';
+ const TOO_LONG_NAME = 'Le nom est trop long : maximum 256 caractères';
+ const NAME_CHANGED = 'Le nom a bien été changé !';
+
+ //changeAccessibility()
+ const MALFORMED_ACCESSIBILITY = 'L\'accessibilité doit être de la forme : "p" ou "x31;41;59;26;53" ou "a42"';
+ const ACCESSIBILITY_CHANGED = 'L\'accessibilité a bien été changée !';
+
+ //setDateCreation()
+ const MALFORMED_DATE = 'La date de création doit être de la forme "AAAA:MM:JJ hh:mm:ss"';
+ const DATE_CREATION_CHANGED = 'La date de création a bien été changée';
+}
\ No newline at end of file
diff --git a/clazz/Langage.class.php b/clazz/Langage.class.php
new file mode 100644
index 0000000..ed882e8
--- /dev/null
+++ b/clazz/Langage.class.php
@@ -0,0 +1,54 @@
+ID = $ID;
+ $this->name = $name;
+ $this->avalivableFiles = explode(" ",$avalivableFiles);
+ $languages[] = $this;
+ }
+
+ public function getID(){
+ return $this->ID;
+ }
+ public function getName(){
+ return $this->name;
+ }
+ public function getAvalivableFiles(){
+ return $this->avalivableFiles;
+ }
+ public function isJarAvalivable(){
+ return in_array("jar",$this->avalivableFiles);
+ }
+ public function isJavaAvalivable(){
+ return in_array("java",$this->avalivableFiles);
+ }
+ public function isJavadocAvalivable(){
+ return in_array("javadoc",$this->avalivableFiles);
+ }
+ public function isXlsmAvalivable(){
+ return in_array("xlsm",$this->avalivableFiles);
+ }
+ public function isVbAvalivable(){
+ return in_array("vb",$this->avalivableFiles);
+ }
+
+ public static function getFromID($ID){
+ foreach(self::$languages AS $language){
+ if($language->getID() == $ID)
+ return $language;
+ }
+ return NULL;
+ }
+
+}
\ No newline at end of file
diff --git a/clazz/Membre.class.php b/clazz/Membre.class.php
index 232d640..5088690 100644
--- a/clazz/Membre.class.php
+++ b/clazz/Membre.class.php
@@ -1 +1,212 @@
-id = $id ?? $_SESSION['session_id']; $this->password = $pass ?? $_SESSION['session_mdp']; $connected = FALSE; } public function connect(){ $req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE ID=?' ); $req->execute (array($this->id)); if ($rep = $req->fetch ()){ $connected = password_verify ( $this->pass, $rep ['mdp'] ); $this->adminLevel = $connected?$result ['administration']:-1; $this->pseudo = $connected?$result['pseudo']:NULL; if($connected)decodeData($rep['data']); return $this->connected = $connected; }else{ $req->closeCursor (); return $this->connected = FALSE; } } public function hasPersonnalMessage(){ return isset($this->personnalMessage); } public function showPersonnalMessage(){ $msg = $this->personnalMessage; $this->personnalMessage = NULL; return $msg; } private function decodeData($data) { $jsonData = json_decode($data); //Set the data's required_banner if it is defined , otherwise sets the DEFAULT_BANNER $this->requiredBanner = $jsonData['requiredBanner'] ?? self::DEFAULT_BANNER; $this->personnalMessage = $jsonData['personnalMessage'] ?? NULL; } private function encodeData(){ $jsonArray = array(); //Set requiredBanner only if it is different from DEFAULT_BANNER $jsonArray['requiredBanner'] = $this->requiredBanner !== self::DEFAULT_BANNER ? $this->requiredBanner : NULL; $jsonArray['personnalMessage'] = $this->personnalMessage ?? NULL; return json_encode($jsonArray); } public function getAdminLevel(){ return $this->adminLevel; } public function getBanner() { return $this->requiredBanner; } public function isConnected(){ return $connected; } public static function tryToConnect($pseudo = NULL,$mdp = NULL){ $pseudo = $pseudo ?? $_POST ['pseudo']; $mdp = $mdp ?? $_POST ['mdp']; $req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE pseudo=?' ); $req->execute ( array ( $pseudo ) ); $reponce = $req->fetch (); if ($reponce != NULL) { if (password_verify ( $mdp, $reponce ['mdp'] )) { $req->closeCursor (); return $reponce ['ID']; } else { $req->closeCursor (); return 'errormdp'; } } else { $req->closeCursor (); return 'errorpseudo'; } } public static function registerPerson($pseudo, $mdp) { $req = $GLOBALS ['bdd']->prepare ( "SELECT * FROM users WHERE pseudo=?" ); $req->execute (array($_POST ['pseudo'])); if ($req->fetch ()) return 'usedPseudo'; $req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO users(pseudo,mdp,date_creation) VALUES (?,?,NOW())' ); $req->execute(array($_POST ['pseudo'],password_hash ( $_POST ['mdp'], PASSWORD_DEFAULT))); return 'ok'; }}
\ No newline at end of file
+ID = $ID;
+ $this->connected = FALSE;
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE ID=?');
+ $req->execute(array($ID));
+ if($rep = $req->fetch()){
+ $this->valid = TRUE;
+ $this->pseudo = $rep['pseudo'];
+ $this->adminLevel = $rep['adminLevel'];
+ $this->dateCreation = $rep['dateCreation'];
+ $this->hashedPassword = $rep['hashedPassword'];
+ $this->decodeData($rep['data']);
+ }else{
+ $this->valid = FALSE;
+ }
+ }
+
+ public function connect($password) {
+ $this->connected = password_verify ( $this->pass, $rep ['mdp'] );
+
+ return $this->connected;
+
+ }
+
+ public function __toString(){
+ $out = 'Membre\n';
+ $out .= '\tID:' . $this->ID . '\n';
+ $out .= '\tPseudo:' . $this->pseudo . '\n';
+ $out .= '\tAdmin level:' . $this->adminLevel . '\n';
+ $out .= '\tDate of creation:' . $this->dateCreation . '\n';
+ $out .= '\tRequired banner:' . $this->requiredBanner . '\n';
+ $out .= '\tPersonnal message:' . $this->personnalMessage . '\n';
+ return out;
+ }
+
+ public function isConnected(){
+ return $this->connected;
+ }
+
+ public function exists(){
+ return $this->valid;
+ }
+
+ private function decodeData($data) {
+ $jsonData = json_decode ( $data );
+ // Set the data's required_banner if it is defined , otherwise sets the DEFAULT_BANNER
+ $this->requiredBanner = $jsonData ['requiredBanner'] ?? self::DEFAULT_BANNER;
+ $this->personnalMessage = $jsonData ['personnalMessage'] ?? NULL;
+ }
+
+
+ //Getters
+ public function getID(){
+ return $this->ID;
+ }
+
+ public function getPseudo(){
+ return $this->pseudo;
+ }
+
+ public function getAdminLevel() {
+ return $this->adminLevel;
+ }
+
+ public function getDateCreation(){
+ return $this->dateCreation;
+ }
+
+ public function getRequiredBanner() {
+ return $this->requiredBanner;
+ }
+
+ public function getPersonnalMessage(){
+ return $this->personnalMessage;
+ }
+
+
+ //Useful getters
+ public function isAdminLevelLowerThan($max){
+ return $this->adminLevel<$max;
+ }
+
+ public function isAdminLevelGreaterThan($min){
+ return $this->adminLevel>$max;
+ }
+
+ public function isAdminLevelLowerOrEqualThan($max){
+ return $this->adminLevel<$max;
+ }
+
+ public function isAdminLevelGreaterOrEqualThan($min){
+ return $this->adminLevel>$max;
+ }
+
+ public function hasPersonnalMessage() {
+ return isset ( $this->personnalMessage );
+ }
+
+ public function showPersonnalMessage() {
+ $msg = $this->personnalMessage;
+ $this->setPersonnalMessage = NULL;
+ return $msg;
+ }
+
+ //Setters
+ public function changePassword($newPassword){
+ if(strlen($newPassword)>255)
+ return Membre::PASSWORD_TOO_LONG;
+ $req = $GLOBALS['bdd']->prepare('UPDATE membres SET mdp=? WHERE ID=?');
+ $req->execute(array(password_hash ( $newPassword, PASSWORD_DEFAULT ),$this->ID));
+ return Membre::PASSWORD_CHANGED;
+ }
+
+
+ //Membre getters
+ private static function memberGetterOutput($req){
+ $out = array();
+ while($rep = $req->fetch())
+ $out[] = new Membre($rep['ID']);
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+ }
+
+ public static function getFromPseudo($pseudo){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE pseudo=?');
+ $req->execute(array($pseudo));
+ return membreGetterOutput($req);
+ }
+
+ public static function getFromAdminLevel($level){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE adminLevel=?');
+ $req->execute(array($level));
+ return membreGetterOutput($req);
+ }
+
+ public static function getFromDateCreation($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE dateCreation=?');
+ $req->execute(array($date));
+ return membreGetterOutput($req);
+ }
+
+ public static function getCreatedLaterThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE dateCreation>?');
+ $req->execute(array($date));
+ return membreGetterOutput($req);
+ }
+
+ public static function getCreatedEarlierThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE dateCreation');
+ $req->execute(array($date));
+ return membreGetterOutput($req);
+ }
+
+ public static function getAdminGreaterThan($min){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE adminLevel>?');
+ $req->execute(array($min));
+ return membreGetterOutput($req);
+ }
+
+ public static function getAdminLowerThan($max){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM membres WHERE adminLevel');
+ $req->execute(array($max));
+ return membreGetterOutput($req);
+ }
+
+
+ //Membre creator
+ public static function registerPerson($pseudo, $mdp) {
+ if (Membre::getFromPseudo($pseudo))
+ return Membre::USED_USERNAME;
+ $req = $GLOBALS ['bdd']->prepare ('INSERT INTO membres(pseudo,mdp,date_creation) VALUES (?,?,NOW())');
+ $req->execute (array($pseudo,password_hash( $mdp, PASSWORD_DEFAULT)));
+ return Membre::USERNAME_CHANGED;
+ }
+
+
+ //Outputs texts
+
+ //changePassword
+ const PASSWORD_TOO_LONG = 'Le mot de passe est trop long ! (Max : 255 caractères)';
+ const PASSWORD_CHANGED = 'Le mot de passe a bien été changé';
+
+ //registerPerson
+ const USED_USERNAME = 'Le pseudonyme est déjà utilisé';
+ const PERSON_REGISTERED = 'Le membre a bien été inscrit !';
+}
+
+
+
+
+
diff --git a/clazz/Message.class.php b/clazz/Message.class.php
new file mode 100644
index 0000000..0d5bd95
--- /dev/null
+++ b/clazz/Message.class.php
@@ -0,0 +1,136 @@
+ID = $ID;
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE ID=?');
+ $req->execute(array($ID));
+ if($rep = $req->fetch()){
+ $this->valid = TRUE;
+ $this->sender = new Membre($rep['senderID']);
+ $this->sendDate = $rep['sendDate'];
+ $this->text = $rep['text'];
+ $this->discussion = new Discussion($rep['discussionID']);
+ }else{
+ $this->valid = FALSE;
+ }
+ }
+
+ public function exists(){
+ return $this->valid;
+ }
+
+ public function __toString(){
+ $out = 'Message\n';
+ $out .= '\tID:' . $this->ID . '\n';
+ $out .= '\tSender:{' . substr(str_replace('\n\t',';',$this->sender->__toString()),0,-1) . '}\n';
+ $out .= '\tSend date:' . $this->sendDate . '\n';
+ $out .= '\tText:' . $this->text . '}\n';
+ $out .= '\tDiscussion:' . substr(str_replace('\n\t',';',$this->discussion->__toString()),0,-1) . '\n';
+ return out;
+ }
+
+
+ //Getters
+ public function getID(){
+ return $this->ID;
+ }
+
+ public function getSender(){
+ return $this->sender;
+ }
+
+ public function getSendDate(){
+ return $this->sendDate;
+ }
+
+ public function getText(){
+ return $this->text;
+ }
+
+ public function getDiscussion(){
+ return $this->discussion;
+ }
+
+
+ //Useful getters
+ public function canEdit($person){
+ return $person->isAdminLevelGreaterOrEqualThan(6) || $person->getID() == $this->sender->getID();
+ }
+
+
+ //Setters
+ public function editText($newText){
+ $this->text = htmlSepcialChars($newText);
+ $req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO messages(discussion_id,texte,senderID,sendTime) VALUES (?,?,?,NOW())' );
+ $req->execute (array ($this->discussion->getID(),$this->text,$this->sender->getID()));
+ }
+
+ //Message getter
+ private static function messagesGetterOutput($req){
+ $out = array();
+ while($rep = $req->fetch())
+ $out[] = new Discussion($rep['ID']);
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+ }
+
+ public static function getFromSender($param) {
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE senderID=?');
+ $req->execute(array($sender->getID()));
+ return messagesGetterOutput($req);
+ }
+
+
+ public static function getFromSendDate($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate=?');
+ $req->execute(array($date));
+ return messagesGetterOutput($req);
+ }
+
+ public static function getSendedLaterThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate>?');
+ $req->execute(array($date));
+ return messagesGetterOutput($req);
+ }
+
+ public static function getSendedEarlierThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate');
+ $req->execute(array($date));
+ return messagesGetterOutput($req);
+ }
+
+ public static function getFromText($text) {
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE text=?');
+ $req->execute(array($text));
+ return messagesGetterOutput($req);
+ }
+
+ public static function getFromDiscussion($discut){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE discussionID=?');
+ $req->execute(array($discut->getID()));
+ return messagesGetterOutput($req);
+ }
+
+
+ //Message creator
+ public static function sendMessage($sender,$discussion,$text){
+ $req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO messages(discussion_id,texte,senderID,sendTime) VALUES (?,?,?,NOW())' );
+ $req->execute (array($discussion->getID(),htmlspecialchars ($text),$sender->getID()));
+ }
+
+}
\ No newline at end of file
diff --git a/clazz/Projet.class.php b/clazz/Projet.class.php
index 898e820..b00d17c 100644
--- a/clazz/Projet.class.php
+++ b/clazz/Projet.class.php
@@ -1,177 +1,176 @@
-ID = $ID;
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM projets WHERE ID=?');
- $req->execute(array($ID));
- if($rep = $req->fetch()){
- $this->valid = TRUE;
- $this->name = $rep['name'];
- $this->owner = new Membre($rep['ownerID']);
- $this->dateCreation = $rep['dateCreation'];
- $this->secondaryOwners = array();
- foreach (explode(';',$rep['secondaryOwners']) AS $secondaryOwner)
- $this->secondaryOwners[] = new Membre($secondaryOwner);
- }else{
- $this->valid = FALSE;
- }
- }
-
- public function exists(){
- return $this->valid;
- }
-
- public function __toString(){
- $out = 'Projet\n';
- $out .= '\tID:' . $this->ID . '\n';
- $out .= '\tName:' . $this->name . '\n';
- $out .= '\tOwner:{' . substr(str_replace('\n\t',';',$this->owner->__toString()),0,-1) . '}\n';
- foreach($this->secondaryOwners AS $secondaryOwner)
- $out .= '\tSecondary owner:{' . substr(str_replace('\n\t',';',$secondaryOwner->__toString()),0,-1) . '}\n';
- $out .= '\tDate of creation:' . $this->dateCreation . '\n';
- return out;
- }
-
- //Getters
- public function getID(){
- return $this->ID;
- }
-
- public function getName(){
- return $this->name;
- }
-
- public function getOwner(){
- return $this->owner;
- }
-
- public function getSecondaryOwners(){
- return $this->secondaryOwners;
- }
-
- public function getDateCreation(){
- return $this->dateCreation;
- }
-
-
- //Useful getters
- public function haveRights($member){
- return $member->getID() == $owner->getID() or in_array($member,$this->secondaryOwners);
- }
-
- //Setters
- public function setSecondaryOwners($secondaryOwners){
- $this->secondaryOwners = $secondaryOwners;
- $secondaryOwnersID = array();
- foreach($secondaryOwners AS $secondaryOwner)$secondaryOwnersID[] = $secondaryOwner->getID();
- $req = $GLOBALS['bdd']->prepare('UPDATE projets SET secondaryOwners=? WHERE ID=?');
- $req->execute(array(implode(';',$secondaryOwnersID),$this->ID));
- }
-
- public function addSecondaryOwner($secondaryOwner){
- $this->secondaryOwners[] = $secondaryOwner;
- $this->setSecondaryOwners($this->secondaryOwners);
- }
-
- public function delSecondaryOwner($secondaryOwner){
- $this->secondaryOwners = array_diff($this->secondaryOwners,array($secondaryOwner));
- $this->setSecondaryOwners($this->secondaryOwners);
- }
-
-
- //Project getters
- private static function projectGetterOutput($req){
- $out = array();
- while($rep = $req->fetch())
- $out[] = new Project($rep['ID']);
- switch(count($out)){
- case 0:
- return NULL;
- case 1:
- return $out[0];
- default:
- return $out;
- }
- }
-
- public static function getFromName($name){
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE name=?');
- $req->execute(array($name));
- return projectGetterOutput($req);
- }
-
- public static function getFromOwner($owner){
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE owner=?');
- $req->execute(array($owner->getID()));
- return projectGetterOutput($req);
- }
-
- public static function getFromSecondaryOwner($secondaryOwner){
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
- $req->execute();
- $out = array();
- while ($rep = $req->fetch()) {
- $projet = new Projet($rep['ID']);
- if ($projet->haveRights($secondaryOwner))
- $out[] = $projet;
- }
- switch(count($out)){
- case 0:
- return NULL;
- case 1:
- return $out[0];
- default:
- return $out;
- }
-
- return projectGetterOutput($req);
- }
-
- public static function getFromDateCreation($date){
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation=?');
- $req->execute(array($date));
- return projectGetterOutput($req);
- }
-
- public static function getCreatedLaterThan($date){
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation>?');
- $req->execute(array($date));
- return projectGetterOutput($req);
- }
-
- public static function getCreatedEarlierThan($date){
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation');
- $req->execute(array($date));
- return projectGetterOutput($req);
- }
-
- public static function getWhichHeCanAccess($he){
- $req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
- $req->execute(array());
- $out = array();
- while ( $rep = $req->fetch()) {
- $disc = new Discussion($rep['ID']);
- if ($disc->canAccess($membre))
- $out[] = $disc;
- }
- switch(count($out)){
- case 0:
- return NULL;
- case 1:
- return $out[0];
- default:
- return $out;
- }
- }
-
-
-
+ID = $ID;
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM projets WHERE ID=?');
+ $req->execute(array($ID));
+ if($rep = $req->fetch()){
+ $this->valid = TRUE;
+ $this->name = $rep['name'];
+ $this->owner = new Membre($rep['ownerID']);
+ $this->dateCreation = $rep['dateCreation'];
+ $this->secondaryOwners = array();
+ foreach (explode(';',$rep['secondaryOwners']) AS $secondaryOwner)
+ $this->secondaryOwners[] = new Membre($secondaryOwner);
+ }else{
+ $this->valid = FALSE;
+ }
+ }
+
+ public function exists(){
+ return $this->valid;
+ }
+
+ public function __toString(){
+ $out = 'Projet\n';
+ $out .= '\tID:' . $this->ID . '\n';
+ $out .= '\tName:' . $this->name . '\n';
+ $out .= '\tOwner:{' . substr(str_replace('\n\t',';',$this->owner->__toString()),0,-1) . '}\n';
+ foreach($this->secondaryOwners AS $secondaryOwner)
+ $out .= '\tSecondary owner:{' . substr(str_replace('\n\t',';',$secondaryOwner->__toString()),0,-1) . '}\n';
+ $out .= '\tDate of creation:' . $this->dateCreation . '\n';
+ return out;
+ }
+
+ //Getters
+ public function getID(){
+ return $this->ID;
+ }
+
+ public function getName(){
+ return $this->name;
+ }
+
+ public function getOwner(){
+ return $this->owner;
+ }
+
+ public function getSecondaryOwners(){
+ return $this->secondaryOwners;
+ }
+
+ public function getDateCreation(){
+ return $this->dateCreation;
+ }
+
+
+ //Useful getters
+ public function haveRights($member){
+ return $member->getID() == $owner->getID() or in_array($member,$this->secondaryOwners);
+ }
+
+ //Setters
+ public function setSecondaryOwners($secondaryOwners){
+ $this->secondaryOwners = $secondaryOwners;
+ $secondaryOwnersID = array();
+ foreach($secondaryOwners AS $secondaryOwner)$secondaryOwnersID[] = $secondaryOwner->getID();
+ $req = $GLOBALS['bdd']->prepare('UPDATE projets SET secondaryOwners=? WHERE ID=?');
+ $req->execute(array(implode(';',$secondaryOwnersID),$this->ID));
+ }
+
+ public function addSecondaryOwner($secondaryOwner){
+ $this->secondaryOwners[] = $secondaryOwner;
+ $this->setSecondaryOwners($this->secondaryOwners);
+ }
+
+ public function delSecondaryOwner($secondaryOwner){
+ $this->secondaryOwners = array_diff($this->secondaryOwners,array($secondaryOwner));
+ $this->setSecondaryOwners($this->secondaryOwners);
+ }
+
+
+ //Project getters
+ private static function projectGetterOutput($req){
+ $out = array();
+ while($rep = $req->fetch())
+ $out[] = new Project($rep['ID']);
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+ }
+
+ public static function getFromName($name){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE name=?');
+ $req->execute(array($name));
+ return projectGetterOutput($req);
+ }
+
+ public static function getFromOwner($owner){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE owner=?');
+ $req->execute(array($owner->getID()));
+ return projectGetterOutput($req);
+ }
+
+ public static function getFromSecondaryOwner($secondaryOwner){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
+ $req->execute();
+ $out = array();
+ while ($rep = $req->fetch()) {
+ $projet = new Projet($rep['ID']);
+ if ($projet->haveRights($secondaryOwner))
+ $out[] = $projet;
+ }
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+ }
+
+ public static function getFromDateCreation($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation=?');
+ $req->execute(array($date));
+ return projectGetterOutput($req);
+ }
+
+ public static function getCreatedLaterThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation>?');
+ $req->execute(array($date));
+ return projectGetterOutput($req);
+ }
+
+ public static function getCreatedEarlierThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation');
+ $req->execute(array($date));
+ return projectGetterOutput($req);
+ }
+
+ public static function getWhichHeCanAccess($he){
+ //TODO Faire la selection directement grâce à une requette SQL
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
+ $req->execute(array());
+ $out = array();
+ while ( $rep = $req->fetch()) {
+ $projet = new Projet($rep['ID']);
+ if ($projet->haveRights($membre))
+ $out[] = $projet;
+ }
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+ }
+
+
+
}
\ No newline at end of file
diff --git a/clazz/Version.class.php b/clazz/Version.class.php
new file mode 100644
index 0000000..44b5703
--- /dev/null
+++ b/clazz/Version.class.php
@@ -0,0 +1,312 @@
+ID = $ID;
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE ID=?');
+ $req->execute(array($ID));
+ if($rep = $req->fetch()){
+ $this->valid = TRUE;
+ $this->name = $rem['name'];
+ $this->sendDate = $rep['sendDate'];
+ $this->publicFiles = explode(" ",$rep['publicFiles']);
+ $this->tags = explode(" ",$rep['tags']);
+ $this->project = new Project($rep['projectID']);
+ $this->language = Langage::getFromID($rep['languageID']);
+ }else{
+ $this->valid = FALSE;
+ }
+ }
+
+ public function exists(){
+ return $this->valid;
+ }
+
+ public function __toString(){
+ $out = 'Version\n';
+ $out .= '\tID:' . $this->ID . '\n';
+ $out .= '\tName:{' . $this->name . '}\n';
+ $out .= '\tSend date:' . $this->sendDate . '\n';
+ $out .= '\tPublic files:"' . implode(' ',$this->publicFiles) . '"}\n';
+ $out .= '\tTags:"' . implode(' ',$this->tags) . '"}\n';
+ $out .= '\tProject:' . substr(str_replace('\n\t',';',$this->project->__toString()),0,-1) . '\n';
+ $out .= '\tLanguage:' . $this->language->getName() . '\n';
+ return out;
+ }
+
+
+ //Getters
+ public function getID(){
+ return $this->ID;
+ }
+
+ public function getName(){
+ return $this->name;
+ }
+
+ public function getSendDate(){
+ return $this->sendDate;
+ }
+
+ public function getPublicFiles(){
+ //returns a string array
+ return $this->publicFiles;
+ }
+
+ public function getTags(){
+ //returns a string array
+ return $this->tags;
+ }
+
+ public function getProject(){
+ return $this->project;
+ }
+
+ public function getLanguage(){
+ return $this->language;
+ }
+
+ //Useful Getters
+ //TODO make all of the following 'is' functions using haveTag
+ public function haveTag($tag){
+ return in_array($tag,$this->tags);
+ }
+
+ public function isJarPublic(){
+ return in_array("jar",$this->publicFiles);
+ }
+
+ public function isJavaPublic(){
+ return in_array("java",$this->publicFiles);
+ }
+
+ public function isJavadocPublic(){
+ return in_array("javadoc",$this->publicFiles);
+ }
+
+ public function isXlsmPublic(){
+ return in_array("xlsm",$this->publicFiles);
+ }
+
+ public function isVbPublic(){
+ return in_array("vb",$this->publicFiles);
+ }
+
+ public function isAlpha(){
+ return in_array("alpha",$this->tags);
+ }
+
+ public function isBeta(){
+ return in_array("beta",$this->tags);
+ }
+
+ public function isRelease(){
+ return in_array("release",$this->tags);
+ }
+
+ public function isTest(){
+ return in_array("test",$this->tags);
+ }
+
+ public function isBugged(){
+ return in_array("bugged",$this->tags);
+ }
+
+ //Setters
+ public function storeTags(){
+ $rep = $GLOBALS['bdd']->prepare('UPDATE versions SET tags=? WHERE ID=?');
+ $rep->execute(array(implode(' ',$this->tags),$this->ID));
+ }
+
+ public function addTag($tag,$store = TRUE){
+ $this->deleteTag($tag,FALSE);
+ $this->tags[] = $tag;
+ if($store)$this->storeTags();
+ }
+
+ public function deleteTag($tag,$store = TRUE){
+ $this->tags = array_diff($this->tags,array($tag));
+ if($store)$this->storeTags();
+ }
+
+ public function setARelease(){
+ $this->deleteTag('alpha',FALSE);
+ $this->deleteTag('beta',FALSE);
+ $this->addTag('release',FALSE);
+ $this->storeTags();
+ }
+
+ public function setAnAlpha(){
+ $this->deleteTag('beta',FALSE);
+ $this->deleteTag('release',FALSE);
+ $this->addTag('alpha',FALSE);
+ $this->storeTags();
+ }
+
+ public function setABeta(){
+ $this->deleteTag('alpha',FALSE);
+ $this->deleteTag('release',FALSE);
+ $this->addTag('beta',FALSE);
+ $this->storeTags();
+ }
+
+ public function setATest(){
+ $this->addTag('test');
+ }
+
+ public function setNotATest(){
+ $this->delTag('test');
+ }
+
+ public function setBugged(){
+ $this->addTag('bugged');
+ }
+
+ public function setNotBugged(){
+ $this->delTag('bugged');
+ }
+
+ public function storePublicFiles(){
+ $rep = $GLOBALS['bdd']->prepare('UPDATE versions SET publicFiles=? WHERE ID=?');
+ $rep->execute(array(implode(' ',$this->publicFiles),$this->ID));
+ }
+
+ public function addPublicFile($file,$store = TRUE){
+ $this->deletePublicFile($file,FALSE);
+ $this->publicFiles[] = $file;
+ if($store)$this->storePublicFiles();
+ }
+
+ public function deletePublicFile($file,$store = TRUE){
+ $this->publicFiles = array_diff($this->publicFiles,array($file));
+ if($store)$this->storePublicFiles();
+ }
+
+ public function setJarPublic(){
+ $this->addPublicFile('jar');
+ }
+
+ public function setJarNotPublic(){
+ $this->deletePublicFile('jar');
+ }
+
+ public function setJavaPublic(){
+ $this->addPublicFile('java');
+ }
+
+ public function setJavaNotPublic(){
+ $this->deletePublicFile('java');
+ }
+
+ public function setJavadocPublic(){
+ $this->addPublicFile('javadoc');
+ }
+
+ public function setJavadocNotPublic(){
+ $this->deletePublicFile('javadoc');
+ }
+
+ public function setXlsmPublic(){
+ $this->addPublicFile('xlsm');
+ }
+
+ public function setXlsmNotPublic(){
+ $this->deletePublicFile('xlsm');
+ }
+
+ public function setVbPublic(){
+ $this->addPublicFile('vb');
+ }
+
+ public function setVbNotPublic(){
+ $this->deletePublicFile('vb');
+ }
+
+
+ //Version Getter
+ private static function versionGetterOutput($req){
+ $out = array();
+ while($rep = $req->fetch())
+ $out[] = new Version($rep['ID']);
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+ }
+
+ public static function getFromLanguage($language){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE languageID=?');
+ $req->execute(array($language->getID()));
+ return versionGetterOutput($req);
+ }
+
+ public static function getFromProject($project){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE projectID=?');
+ $req->execute(array($project->getID()));
+ return versionGetterOutput($req);
+ }
+
+ public static function getFromName($name){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE name=?');
+ $req->execute(array($name));
+ return versionGetterOutput($req);
+ }
+
+ public static function getFromTag($tag){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions');
+ $req->execute();
+ $out = array();
+ while ($rep = $req->fetch()) {
+ $projet = new Version($rep['ID']);
+ if ($projet->haveTag($tag))
+ $out[] = $projet;
+ }
+ switch(count($out)){
+ case 0:
+ return NULL;
+ case 1:
+ return $out[0];
+ default:
+ return $out;
+ }
+
+ return projectGetterOutput($req);
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE languageID=?');
+ $req->execute(array($language->getID()));
+ return versionGetterOutput($req);
+ }
+
+ public static function getFromSendDate($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate=?');
+ $req->execute(array($date));
+ return versionsGetterOutput($req);
+ }
+
+ public static function getSendedLaterThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate>?');
+ $req->execute(array($date));
+ return versionsGetterOutput($req);
+ }
+
+ public static function getSendedEarlierThan($date){
+ $req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate');
+ $req->execute(array($date));
+ return versionsGetterOutput($req);
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/clazz/Zincluder.php b/clazz/Zincluder.php
new file mode 100644
index 0000000..71918e8
--- /dev/null
+++ b/clazz/Zincluder.php
@@ -0,0 +1,16 @@
+getMessage());
+}
+
+//TODO in the classes , do more test of exists in setters
+include_once 'clazz/Langage.class.php';
+include_once 'clazz/Membre.class.php';
+include_once 'clazz/Discussion.class.php';
+include_once 'clazz/Message.class.php';
+include_once 'clazz/Projet.class.php';
+//Use class's consts for file names
+include_once 'clazz/Version.class.php';
diff --git a/form.php b/form.php
deleted file mode 100644
index 7b11501..0000000
--- a/form.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/includes/header.php b/includes/header.php
index 9577040..c70a446 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -13,6 +13,20 @@
000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000
+-->