Maintenant, tout dans le executor.php. Fin de tempPreMega.
Ajout d'un super simulateur de tours de Monoï dans la page 404.
This commit is contained in:
parent
228f54d140
commit
38ec48c9fc
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "includes/MathJax"]
|
||||||
|
path = includes/MathJax
|
||||||
|
url = https://github.com/mathjax/MathJax.git
|
||||||
47
404.php
47
404.php
@ -18,42 +18,17 @@
|
|||||||
|
|
||||||
<button onclick="window.history.go(-1);" >Page précédente</button><br/>
|
<button onclick="window.history.go(-1);" >Page précédente</button><br/>
|
||||||
|
|
||||||
Si vous le voulez , vous pouvez essayer de trouver le code html de votre page web là dedans:<br/>
|
<?php
|
||||||
|
switch(rand(0,1)){
|
||||||
<!---->
|
case 1:
|
||||||
<div id="universe_text"></div>
|
include 'allein/pieces.php';
|
||||||
|
break;
|
||||||
<div id="add_universe" style="width:34px;height:21px;">
|
default:
|
||||||
Plus
|
include 'allein/univers.php';
|
||||||
<div id="egg" style="color:#222;">
|
|
||||||
egg
|
|
||||||
</div>
|
|
||||||
</div><br/>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var charsMaxPerPlus = 1000;
|
|
||||||
var n = 1;
|
|
||||||
var clics = 0;
|
|
||||||
var plus = document.getElementById('add_universe');
|
|
||||||
function addUniverseText(){
|
|
||||||
var textToAdd = '';
|
|
||||||
clics+=1;
|
|
||||||
while(textToAdd.length < charsMaxPerPlus*clics){
|
|
||||||
textToAdd+=Math.pow(2,n)+" ";
|
|
||||||
n+=1;
|
|
||||||
}
|
|
||||||
var div = document.getElementById("universe_text");
|
|
||||||
div.innerHTML+=textToAdd;
|
|
||||||
}
|
}
|
||||||
var egg = document.getElementById('egg');
|
?>
|
||||||
egg.addEventListener('click',function(){
|
|
||||||
clics +=1000;
|
|
||||||
});
|
|
||||||
plus.onclick = addUniverseText;
|
|
||||||
addUniverseText();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
450
admin.php
450
admin.php
@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once 'clazz/Zincluder.php;';
|
|
||||||
session_start ();
|
session_start ();
|
||||||
|
include_once 'clazz/Zincluder.php';
|
||||||
|
if( !isset($_SESSION ['session_id']) or !isset($_SESSION ['session_mdp']) ) {
|
||||||
|
header ( 'Location:401.php' );
|
||||||
|
exit ();
|
||||||
|
}
|
||||||
$me = new Membre ( $_SESSION ['session_id'] );
|
$me = new Membre ( $_SESSION ['session_id'] );
|
||||||
$me->connect ( $_SESSION ['session_mdp'] );
|
$me->connect ( $_SESSION ['session_mdp'] );
|
||||||
if ($me->isAdminLevelLowerThan ( 15 )) {
|
if ($me->isAdminLevelLowerThan ( 15 )) {
|
||||||
@ -10,167 +14,293 @@ if ($me->isAdminLevelLowerThan ( 15 )) {
|
|||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="css/adminStyle.css" />
|
<link rel="stylesheet" href="css/adminStyle.css"/>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8"/>
|
||||||
<title>La console d'admin</title>
|
<title>La console d'admin</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
<script>jQuery.fn.extend({disable: function(state){return this.each(function(){this.disabled=state;});}});</script>
|
||||||
|
<section class="commander">
|
||||||
|
<div class="commanderCommandSelector">
|
||||||
|
Commande :
|
||||||
|
<select id="commandSelector">
|
||||||
|
<option value="get" selected="true">get</option>
|
||||||
|
<option value="set">set</option>
|
||||||
|
<option value="remove">remove</option>
|
||||||
|
<option value="add">add</option>
|
||||||
|
<option value="bdd">bdd</option>
|
||||||
|
</select><br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<select id="commandSelector">
|
<div class="commander" id="getCommander" style="display: block;">
|
||||||
<option value="get" selected="true">get</option>
|
<label for="getCommanderCibleSelector">Cible :</label>
|
||||||
<option value="set">set</option>
|
<input type="text" id="getCommanderCibleSelector" alt="Un selecteur" title="Un selecteur"/>
|
||||||
<option value="remove">remove</option>
|
</div>
|
||||||
<option value="add">add</option>
|
|
||||||
<option value="BDD">BDD</option>
|
<div class="commander" id="setCommander" style="display: none;">
|
||||||
</select>
|
<label for="setCommanderCibleSelector">Cible :</label>
|
||||||
|
<input type="text" id="setCommanderCibleSelector" alt="Un selecteur" title="Un selecteur"/><br/>
|
||||||
<div id="setDiv">
|
|
||||||
|
|
||||||
<form id="setFormObject">
|
|
||||||
Objet<br /> <select class="classSelector" id="setClassSelector">
|
|
||||||
<!-- Rempli en JS -->
|
|
||||||
</select><br />
|
|
||||||
<button id="selectFromObject">Séléctionner</button>
|
|
||||||
</form>
|
|
||||||
<!--
|
|
||||||
Pour enlever les vilains whitespace
|
|
||||||
-->
|
|
||||||
<form id="setChampsForm">
|
|
||||||
Valeur<br /> <select id="setChamps">
|
|
||||||
<!-- Rempli en JS -->
|
|
||||||
</select> <select id="arrayOperation">
|
|
||||||
<option value="add" selected="selected">add</option>
|
|
||||||
<option value="set">set</option>
|
|
||||||
<option value="remove">remove</option>
|
|
||||||
</select> <input type="text" id="primitiveValueField" />
|
|
||||||
<button id="selectComplexValue">Séléctionner</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<button id="send">Envoyer la requête</button>
|
|
||||||
<br />
|
|
||||||
<samp id="adminDialogAnswer">
|
|
||||||
Hello !!!<br />
|
|
||||||
</samp>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="fullscreen opaque">
|
|
||||||
<div class="screen-vertical-centered">
|
|
||||||
<form class="screen-horizontal-centered selectorForm">
|
|
||||||
<!-- ID set en JS (bonjour la galère) -->
|
|
||||||
|
|
||||||
<!-- Attributs remplis en JS -->
|
|
||||||
<span>
|
|
||||||
<input type="checkbox" />
|
|
||||||
<h5>Nom du champ</h5>
|
|
||||||
<select>
|
|
||||||
<option value="ee">=</option>
|
|
||||||
<option value="lt"><</option>
|
|
||||||
<option value="gt">></option>
|
|
||||||
<option value="ge">≥</option>
|
|
||||||
<option value="le">≤</option>
|
|
||||||
<option value="ne">≠</option>
|
|
||||||
</select>
|
|
||||||
<input type="text" />
|
|
||||||
<button id="nomDuChampSelector">Selecteur</button>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function done(){
|
|
||||||
var objet = $(this).parent().data('object');//SetObjectSelector-projectSelector
|
|
||||||
var selector = new Array();
|
|
||||||
/*
|
|
||||||
$(this).parent().children('div').each(function() {
|
|
||||||
if($(this).children('input[type="checkbox"]').is(':selected')){
|
|
||||||
var varName = $(this).parent().children('h5').text();
|
|
||||||
var operator = $(this).parent().children('h5').text();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
$(this).parent().children('div').children('input[type="checkbox"]:selected').each(function() {
|
|
||||||
var varName = $(this).parent().children('h5').text();
|
|
||||||
var operator = $(this).parent().children('select').find(':selected').attr('value');
|
|
||||||
var value;
|
|
||||||
if($(this).parent().children('input[type="text"]').length)
|
|
||||||
value = $(this).parent().children('input[type="text"]').val();
|
|
||||||
else
|
|
||||||
value = $(this).parent().children('button').data('selector');
|
|
||||||
selector[varName] = operator+value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('#'+objet).data('selector',JSON.stringify(selector));
|
|
||||||
}
|
|
||||||
|
|
||||||
function selector(object,clazz) {
|
|
||||||
var newForm = $('<form></form>');
|
|
||||||
newForm.data('object',object);
|
|
||||||
switch(clazz){
|
|
||||||
case 'membre':
|
|
||||||
newForm.append(selectorNode('pseudo',true,false,false));
|
|
||||||
newForm.append(selectorNode('password',true,false,false));
|
|
||||||
newForm.append(selectorNode('adminLevel',true,false,true));
|
|
||||||
newForm.append(selectorNode('dateCreation',true,false,true));
|
|
||||||
newForm.append(selectorNode('requiredBanner',true,false,false));
|
|
||||||
newForm.append(selectorNode('personnalMessage',true,false,false));
|
|
||||||
break;
|
|
||||||
case 'projet':
|
|
||||||
newForm.append(selectorNode('name',true,false,false));
|
|
||||||
newForm.append(selectorNode('dateCreation',true,false,true));
|
|
||||||
newForm.append(selectorNode('owner',false,false,false));
|
|
||||||
newForm.append(selectorNode('secondaryOwner',false,true,false));
|
|
||||||
break;
|
|
||||||
case 'version':
|
|
||||||
newForm.append(selectorNode('name',true,false,false));
|
|
||||||
newForm.append(selectorNode('sendDate',true,false,true));
|
|
||||||
newForm.append(selectorNode('publicFiles',true,true,false));
|
|
||||||
newForm.append(selectorNode('tags',true,true,false));
|
|
||||||
newForm.append(selectorNode('project',false,false,false));
|
|
||||||
newForm.append(selectorNode('language',true,false,false));
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
<label for="setCommanderAttributeSelector">Attribut :</label>
|
||||||
|
<input type="text" id="setCommanderAttributeSelector" alt="Un nom d'attribut" title="Un nom d'attribut"/><br/>
|
||||||
|
|
||||||
|
<label for="setCommanderValeurSelector">Valeur :</label>
|
||||||
|
<input type="text" id="setCommanderValeurSelector" alt="Une valeur" title="Une valeur"/><br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="commander" id="addCommander" style="display: none;">
|
||||||
|
Sujet :
|
||||||
|
<select id="addClassSelector">
|
||||||
|
<option value="membre" selected="true">Membre</option>
|
||||||
|
<option value="discussion">Discussion</option>
|
||||||
|
<option value="message">Message</option>
|
||||||
|
<option value="projet">Projet</option>
|
||||||
|
<option value="version">Version</option>
|
||||||
|
</select><br/>
|
||||||
|
|
||||||
|
<div class="addDivAttribute" id="addDivAttributeMembre" style="display: block;">
|
||||||
|
<span>Pseudo :<input type="text" class="addCommanderAttribute pseudo" alt="Un pseudonyme valide" title="Un pseudonyme valide"/></span><br/>
|
||||||
|
<span>Mot de passe :<input type="text" class="addCommanderAttribute mdp" alt="Un mot de passe valide" title="Un mot de passe valide"/></span><br/>
|
||||||
|
<span>Email :<input type="text" class="addCommanderAttribute email" alt="Une adresse mail valide (outrepasse la vérification)" title="Une adresse mail valide (outrepasse la vérification)"/></span><br/>
|
||||||
|
<span class="facultatif">Date de création :<input type="text" class="addCommanderAttribute dateCreation" alt="Une date Mysql valide (AAAA-MM-JJ hh:mm:ss), si vide, la date de réception de la requête" title="Une date Mysql valide (AAAA-MM-JJ hh:mm:ss), si vide, la date de réception de la requête"/></span><br/>
|
||||||
|
<span class="facultatif">Bannière :<input type="text" class="addCommanderAttribute banniere" alt="Un chemin vers une image, si vide, alors utilise la bannière de base" title="Un chemin vers une image, si vide, alors utilise la bannière de base"/></span><br/>
|
||||||
|
<span class="facultatif">Message :<input type="text" class="addCommanderAttribute message" alt="Une chaine de caractères, si vide, aucun message ne sera affiché" title="Une chaine de caractères, si vide, aucun message ne sera affiché"/></span><br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="addDivAttribute" id="addDivAttributeDiscussion" style="display: none;">
|
||||||
|
<span>Nom :<input type="text" class="addCommanderAttribute nom" alt="Un nom de discussion valide" title="Un nom de discussion valide"/></span><br/>
|
||||||
|
<span>Créateur :<input type="text" class="addCommanderAttribute createur" alt="Un sélécteur de membre ou un nombre (ID du membre)" title="Un sélécteur de membre ou un nombre (ID du membre)"/></span><br/>
|
||||||
|
<span class="facultatif">Date de création :<input type="text" class="addCommanderAttribute dateCreation" alt="Une date Mysql valide (AAAA-MM-JJ hh:mm:ss), si vide, la date de réception de la requête" title="Une date Mysql valide (AAAA-MM-JJ hh:mm:ss), si vide, la date de réception de la requête"/></span><br/>
|
||||||
|
<span class="facultatif">Autorisations :<input type="text" class="addCommanderAttribute autorisations" alt="Une chaine de la forme permission : a10 -> niveau d'administration ≥ 10 p -> pas de restrictions x13,35,87 -> autorise les membres à l'ID égal à 13, 35 ou 87 Si vide, publique" title="Une chaine de la forme permission : a10 -> niveau d'administration ≥ 10 p -> pas de restrictions x13,35,87 -> autorise les membres à l'ID égal à 13, 35 ou 87 Si vide, publique"/></span><br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="addDivAttribute" id="addDivAttributeMessage" style="display: none;">
|
||||||
|
<span>Texte :<input type="text" class="addCommanderAttribute texte" alt="Un texte de message" title="Un texte de message"/></span><br/>
|
||||||
|
<span>Sender :<input type="text" class="addCommanderAttribute sender" alt="Un sélécteur de membre ou un nombre (ID du membre)" title="Un sélécteur de membre ou un nombre (ID du membre)"/></span><br/>
|
||||||
|
<span>Discussion :<input type="text" class="addCommanderAttribute discussion" alt="Un selecteur de discussion ou un nombre (ID de la discussion)" title="Un selecteur de discussion ou un nombre (ID de la discussion)"/></span><br/>
|
||||||
|
<span class="facultatif">Date d'envoi :<input type="text" class="addCommanderAttribute dateEnvoi" alt="Une date Mysql valide (AAAA-MM-JJ hh:mm:ss), si vide, la date de réception de la requête" title="Une date Mysql valide (AAAA-MM-JJ hh:mm:ss), si vide, la date de réception de la requête"/></span><br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="addDivAttribute" id="addDivAttributeProjet" style="display: none;">
|
||||||
|
<span>Nom :<input type="text" class="addCommanderAttribute nom" alt="Un nom de projet valide" title="Un nom de projet valide"/></span><br/>
|
||||||
|
<div class="pocesseur">
|
||||||
|
<span>Pocesseur :<input type="text" class="addCommanderAttribute pocesseur" alt="Un sélécteur de membre ou un nombre (ID du membre)" title="Un sélécteur de membre ou un nombre (ID du membre)"/></span><br/>
|
||||||
|
<button id="addProjetAddPocesseur">Ajouter un pocesseur</button><br/>
|
||||||
|
</div>
|
||||||
|
<span class="facultatif">Permissions :<input type="text" class="addCommanderAttribute permissions" alt="Quatre bits pour les permissions, si vide: 1000" title="Quatre bits pour les permissions, si vide: 1000"/></span><br/>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="addDivAttribute" id="addDivAttributeVersion" style="display: none;">
|
||||||
|
<span>Nom :<input type="text" class="addCommanderAttribute nom" alt="Un nom de version valide" title="Un nom de version valide"/></span><br/>
|
||||||
|
<span>Projet :<input type="text" class="addCommanderAttribute projet" alt="Un selecteur de projet ou un nombre (ID du projet)" title="Un selecteur de projet ou un nombre (ID du projet)"/></span><br/>
|
||||||
|
<span class="facultatif">Version absolue :<input type="text" class="addCommanderAttribute versionAbsolue" alt="Un nombre pour trier les versions, si vide, le nombre suivant la plus grande valeur de version absolue pour toute les versions de ce projet" title="Un nombre pour trier les versions, si vide, le nombre suivant la plus grande valeur de version absolue pour toute les versions de ce projet"/></span><br/>
|
||||||
|
<span class="facultatif">Langage :<input type="text" class="addCommanderAttribute langage" alt="Un nombre correspondant au langage de programmation 0->Java 1->VBA Si vide, 0 sélectionné (Java)" title="Un nombre correspondant au langage de programmation 0->Java 1->VBA Si vide, 0 sélectionné (Java)"/></span><br/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="commander" id="removeCommander" style="display: none;">
|
||||||
|
<label for="removeCommanderSelector">Cible :</label>
|
||||||
|
<input type="text" id="removeCommanderSelector" alt="Un selecteur" title="Un selecteur"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="commander" id="bddCommander" style="display: none;">
|
||||||
|
Action :
|
||||||
|
<select id="bddActionSelector">
|
||||||
|
<option value="sort" selected="true">Sort</option>
|
||||||
|
<option value="save">Save</option>
|
||||||
|
<option value="retieve">Retieve</option>
|
||||||
|
</select><br/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function updateCommandSelector(){
|
||||||
|
$('div.commander').hide();
|
||||||
|
switch($('#commandSelector').val()){
|
||||||
|
case 'get':
|
||||||
|
$('#getCommander').show();
|
||||||
|
break;
|
||||||
|
case 'set':
|
||||||
|
$('#setCommander').show();
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
$('#addCommander').show();
|
||||||
|
break;
|
||||||
|
case 'remove':
|
||||||
|
$('#removeCommander').show();
|
||||||
|
break;
|
||||||
|
case 'bdd':
|
||||||
|
$('#bddCommander').show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
newForm.append('<br/>');
|
$('#commandSelector').change(updateCommandSelector);
|
||||||
newForm.append('<button id="selectorAbort">Annuler</button>')
|
|
||||||
newForm.append('<button id="selectorDone">Terminé</button>');
|
function updateAddCommandClassSelector(){
|
||||||
$('form.selectorForm').replaceWith(newForm);
|
$('div.addDivAttribute').hide();
|
||||||
}
|
switch($('#addClassSelector').val()){
|
||||||
function selectorNode(name,primitive,array,number){
|
case 'membre':
|
||||||
var span = $('<span></span>');
|
$('#addDivAttributeMembre').show();
|
||||||
span.append('<input type="checkbox" />')
|
break;
|
||||||
span.append('<h5>'+name+'</h5>')
|
case 'discussion':
|
||||||
if(number)
|
$('#addDivAttributeDiscussion').show();
|
||||||
span.append('<select><option value="ee">=</option><option value="lt"><</option><option value="gt">></option><option value="ge">≥</option><option value="le">≤</option><option value="ne">≠</option></select>')
|
break;
|
||||||
else if(array)
|
case 'message':
|
||||||
span.append('<select><option value="in">∈</option><option value="nn">∉</option></select>')
|
$('#addDivAttributeMessage').show();
|
||||||
else
|
break;
|
||||||
span.append('<select><option value="ee">=</option><option value="ne">≠</option></select>')
|
case 'projet':
|
||||||
if(primitive)
|
$('#addDivAttributeProjet').show();
|
||||||
span.append('<input type="text" />')
|
break;
|
||||||
else
|
case 'version':
|
||||||
span.append('<button id="'+name+'Selector">Selecteur</button>')
|
$('#addDivAttributeVersion').show();
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
function genClassesSelectors{
|
}
|
||||||
$('select.classSelector')
|
$('#addClassSelector').change(updateAddCommandClassSelector);
|
||||||
.append('<option value="membre">Membre</option>')
|
|
||||||
.append('<option value="projet">Projet</option>')
|
updateCommandSelector();
|
||||||
.append('<option value="version">Version</option>')
|
updateAddCommandClassSelector();
|
||||||
.append('<option value="discussion">Discussion</option>')
|
|
||||||
.append('<option value="message">Message</option>');
|
function addProjetAddPocesseur(){
|
||||||
}
|
$('#addProjetAddPocesseur').before('<span>Pocesseur :<input type="text" class="addCommanderAttribute pocesseur" alt="Un sélécteur de membre ou un nombre (ID du membre)" title="Un sélécteur de membre ou un nombre (ID du membre)"/></span>');
|
||||||
$(window).load(genClassesSelectors);
|
$($('#addProjetAddPocesseur').prev().children()[0]).keyup(updateCommandOutput);
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
$('#addProjetAddPocesseur').before('<button class="addProjetRemovePocesseur">-</button>')
|
||||||
|
$('#addProjetAddPocesseur').prev().click(addProjetRemovePocesseur);
|
||||||
|
$('#addProjetAddPocesseur').before('<br/>');
|
||||||
|
updateCommandOutput();
|
||||||
|
}
|
||||||
|
$('#addProjetAddPocesseur').click(addProjetAddPocesseur);
|
||||||
|
|
||||||
|
function addProjetRemovePocesseur(e){
|
||||||
|
$(e.target).prev().remove();
|
||||||
|
$(e.target).next().remove();
|
||||||
|
$(e.target).remove();
|
||||||
|
updateCommandOutput();
|
||||||
|
}
|
||||||
|
$('.addProjetRemovePocesseur').click(addProjetRemovePocesseur);
|
||||||
|
|
||||||
|
var commandMode = 'gui';
|
||||||
|
function switchCommandMode(){
|
||||||
|
|
||||||
</body>
|
}
|
||||||
</html>
|
$('#switchMode').click(switchCommandMode);
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
var command = "";
|
||||||
|
var allRequiredFieldsFilled = false;
|
||||||
|
function updateCommandOutput(e){
|
||||||
|
switch($('#commandSelector').val()){
|
||||||
|
case 'get':
|
||||||
|
var cible = $('#getCommanderCibleSelector').val();
|
||||||
|
command = 'GET' + ' ' + cible;
|
||||||
|
allRequiredFieldsFilled = !!cible;
|
||||||
|
break;
|
||||||
|
case 'set':
|
||||||
|
var cible = $('#setCommanderCibleSelector').val();
|
||||||
|
var attribut = $('#setCommanderAttributeSelector').val();
|
||||||
|
var valeur = $('#setCommanderValeurSelector').val();
|
||||||
|
allRequiredFieldsFilled = !!cible && !!attribut && !!valeur;
|
||||||
|
command = 'SET' + ' ' + cible + ' ' + attribut + ' ' + valeur;
|
||||||
|
break;
|
||||||
|
case 'remove':
|
||||||
|
var cible = $('#removeCommanderSelector').val();
|
||||||
|
command = 'REMOVE' + ' ' + cible;
|
||||||
|
allRequiredFieldsFilled = !!cible;
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
command = 'ADD ' + $('#addClassSelector').val() + ' ';
|
||||||
|
switch($('#addClassSelector').val()){
|
||||||
|
case 'membre':
|
||||||
|
var pseudo = $('#addDivAttributeMembre > span > .pseudo').val();
|
||||||
|
var mdp = $('#addDivAttributeMembre > span > .mdp').val();
|
||||||
|
var email = $('#addDivAttributeMembre > span > .email').val();
|
||||||
|
var dateCreation = $('#addDivAttributeMembre > span > .dateCreation').val();
|
||||||
|
var banniere = $('#addDivAttributeMembre > span > .banniere').val();
|
||||||
|
var message = $('#addDivAttributeMembre > span > .message').val();
|
||||||
|
|
||||||
|
command += 'pseudo "' + pseudo + '"' + ' mdp "' + mdp + '"' + ' email "' + email + '"' + ((dateCreation!='')?' dateCreation "' + dateCreation + '"' : '') + ((banniere!='')?' banniere "' + banniere + '"' : '') + ((message!='')?' message "' + message + '"' : '');
|
||||||
|
allRequiredFieldsFilled = !!pseudo && !!mdp && !!email;
|
||||||
|
break;
|
||||||
|
case 'discussion':
|
||||||
|
var nom = $('#addDivAttributeDiscussion > span > .nom').val();
|
||||||
|
var createur = $('#addDivAttributeDiscussion > span > .createur').val();
|
||||||
|
var dateCreation = $('#addDivAttributeDiscussion > span > .dateCreation').val();
|
||||||
|
var autorisations = $('#addDivAttributeDiscussion > span > .autorisations').val();
|
||||||
|
|
||||||
|
command += 'nom "' + nom + '"' + ' createur ' + ((createur!='')?createur:'???') + '' + ((dateCreation!='')?' dateCreation "' + dateCreation + '"' : '') + ((autorisations!='')?' autorisations "' + autorisations + '"' : '');
|
||||||
|
allRequiredFieldsFilled = !!nom && !!createur;
|
||||||
|
break;
|
||||||
|
case 'message':
|
||||||
|
var texte = $('#addDivAttributeMessage > span > .texte').val();
|
||||||
|
var sender = $('#addDivAttributeMessage > span > .sender').val();
|
||||||
|
var discussion = $('#addDivAttributeMessage > span > .discussion').val();
|
||||||
|
var dateEnvoi = $('#addDivAttributeMessage > span > .dateEnvoi').val();
|
||||||
|
|
||||||
|
command += 'texte "' + texte + '"' + ' sender ' + ((sender!='')?sender:'???') + ' discussion ' + ((discussion!='')?discussion:'???') + ((dateEnvoi!='')?' dateEnvoi "' + dateEnvoi + '"' : '');
|
||||||
|
allRequiredFieldsFilled = !!texte && !!sender && !!discussion;
|
||||||
|
break;
|
||||||
|
case 'projet':
|
||||||
|
var nom = $('#addDivAttributeProjet > span > .nom').val();
|
||||||
|
var permissions = $('#addDivAttributeProjet > span > .permissions').val();
|
||||||
|
pocesseurs = [];
|
||||||
|
$('.addCommanderAttribute.pocesseur').each(function(i) {
|
||||||
|
if($(this).val() != "")pocesseurs.push($(this).val());
|
||||||
|
});
|
||||||
|
command += 'nom "' + nom + '"' + ((permissions!='')?' permissions "' + permissions + '"' : '') + ' pocesseurs [ ' + pocesseurs.join(' ') +' ]';
|
||||||
|
allRequiredFieldsFilled = !!nom && pocesseurs.length > 0;
|
||||||
|
break;
|
||||||
|
case 'version':
|
||||||
|
var nom = $('#addDivAttributeVersion > span > .nom').val();
|
||||||
|
var projet = $('#addDivAttributeVersion > span > .projet').val();
|
||||||
|
var versionAbsolue = $('#addDivAttributeVersion > span > .versionAbsolue').val();
|
||||||
|
var langage = $('#addDivAttributeVersion > span > .langage').val();
|
||||||
|
|
||||||
|
command += 'nom "' + nom + '"' + ' projet ' + ((projet!='')?projet:'???') + ((versionAbsolue!='')?' versionAbsolue ' + versionAbsolue:'') + ((langage!='')?' langage ' + langage:'');
|
||||||
|
allRequiredFieldsFilled = !!nom && !!projet;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'bdd':
|
||||||
|
var action = $('#bddActionSelector').val();
|
||||||
|
command = 'BDD' + ' ' + action;
|
||||||
|
allRequiredFieldsFilled = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$('#send').disable(!allRequiredFieldsFilled);
|
||||||
|
$('#currentCommand').text(command);
|
||||||
|
}
|
||||||
|
$('select').change(updateCommandOutput);
|
||||||
|
$('input[type="text"]').keyup(updateCommandOutput);
|
||||||
|
</script>
|
||||||
|
<br/>
|
||||||
|
<section>
|
||||||
|
Commande :«<span id="currentCommand">...</span>»
|
||||||
|
<button id="send">Envoyer la requête</button>
|
||||||
|
<button id="switchMode">Passer en mode commande</button>
|
||||||
|
</section>
|
||||||
|
<br/>
|
||||||
|
<section class="reponce">
|
||||||
|
<h3>Dialogue :</h3>
|
||||||
|
<samp id="adminDialogAnswer">
|
||||||
|
Hello !!!<br />
|
||||||
|
</samp>
|
||||||
|
</section>
|
||||||
|
<footer>
|
||||||
|
<h5>Syntaxes :</h5>
|
||||||
|
GET selector<br/>
|
||||||
|
SET selector attributeName value<br/>
|
||||||
|
REMOVE selector<br/>
|
||||||
|
ADD class attributeName attributeValue attributeName attributeValue<br/>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@ -154,7 +154,7 @@ $command=$_POST['command'].' ';
|
|||||||
$nommes=array();
|
$nommes=array();
|
||||||
$pos=0;
|
$pos=0;
|
||||||
while ($pos<strlen($command)) {
|
while ($pos<strlen($command)) {
|
||||||
|
echo $pos;
|
||||||
$nomme = array();
|
$nomme = array();
|
||||||
$type=$command[$pos];
|
$type=$command[$pos];
|
||||||
if(isAlphabetic($type)){
|
if(isAlphabetic($type)){
|
||||||
@ -181,12 +181,10 @@ while ($pos<strlen($command)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//DEBUG
|
|
||||||
/*
|
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
print_r($nommes);
|
print_r($nommes);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
*/
|
|
||||||
|
|
||||||
function exception($reason){
|
function exception($reason){
|
||||||
echo 'An exception occurred : '.$reason;
|
echo 'An exception occurred : '.$reason;
|
||||||
@ -269,8 +267,7 @@ if($nommes[0][0] == 'a'){
|
|||||||
}
|
}
|
||||||
echo '<br/><pre>';
|
echo '<br/><pre>';
|
||||||
print_r($objectsToSet);
|
print_r($objectsToSet);
|
||||||
echo '</pre>';+
|
echo '</pre>';
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'DELETE':
|
case 'DELETE':
|
||||||
|
|||||||
156
allein/pieces.php
Normal file
156
allein/pieces.php
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
<span id="out"></span><br/>
|
||||||
|
<canvas id="pieces" width="1000" height="500"></canvas>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var pieceColor = "#33E722";
|
||||||
|
var backColor = "#212121";
|
||||||
|
var canvas = document.getElementById('pieces');
|
||||||
|
var drawWidth = document.body.clientWidth - 50
|
||||||
|
canvas.width = drawWidth;
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
ctx.fillStyle = backColor;
|
||||||
|
ctx.fillRect(0,0,drawWidth,500);
|
||||||
|
roundRect(ctx,10,10,100,70,5,true,false);
|
||||||
|
var tas=[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],[],[]];
|
||||||
|
//var tas=[[0,1,2],[],[]];
|
||||||
|
var X = [drawWidth/4,drawWidth/2,3*drawWidth/4];
|
||||||
|
var Y = 450;
|
||||||
|
var Yhigh = 30;
|
||||||
|
var moves = [];
|
||||||
|
var pieceHeigth = 7;
|
||||||
|
var pieceLevitation = 1;
|
||||||
|
var speed = 5;
|
||||||
|
var pieceDelta = 1;
|
||||||
|
var getWidthFromSize = function(x){return 7*x+10;}
|
||||||
|
var entreDeux = 200;
|
||||||
|
document.getElementById('out').innerHTML="Géneration des déplacements";
|
||||||
|
bouge(0,2,1,19);
|
||||||
|
document.getElementById('out').innerHTML="Placement des pieces";
|
||||||
|
redraw();
|
||||||
|
|
||||||
|
function bouge(a,b,c,z){
|
||||||
|
if(z===1){moves.push([a,b]);return;}
|
||||||
|
bouge(a,c,b,z-1);
|
||||||
|
bouge(a,b,c,1);
|
||||||
|
bouge(c,b,a,z-1);
|
||||||
|
}
|
||||||
|
da = moves[moves.length-1][0];
|
||||||
|
db = moves[moves.length-1][1];
|
||||||
|
deplacer(da,db);
|
||||||
|
|
||||||
|
function pieceDeplacing(){
|
||||||
|
var signe = (da>db)?-1:1;
|
||||||
|
ctx.fillStyle = backColor;
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
oldX = oldX + (signe * pieceDelta);
|
||||||
|
if((signe===1)?oldX>=endX:oldX<=endX){
|
||||||
|
setTimeout(pieceDescending,speed);
|
||||||
|
oldX = endX;
|
||||||
|
}else
|
||||||
|
setTimeout(pieceAscending,speed);
|
||||||
|
|
||||||
|
ctx.fillStyle = pieceColor;
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pieceAscending(){
|
||||||
|
ctx.fillStyle = backColor;
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
oldY = oldY-pieceDelta;
|
||||||
|
if(oldY<=topY){
|
||||||
|
oldY = topY
|
||||||
|
setTimeout(pieceDeplacing,speed);
|
||||||
|
}else
|
||||||
|
setTimeout(pieceAscending,speed);
|
||||||
|
ctx.fillStyle = pieceColor;
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pieceDescending(){
|
||||||
|
ctx.fillStyle = backColor;
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
oldY = oldY + pieceDelta;
|
||||||
|
if(oldY>=endY){
|
||||||
|
oldY = endY;
|
||||||
|
setTimeout(finishDeplacing,speed);
|
||||||
|
}else
|
||||||
|
setTimeout(pieceDescending,speed);
|
||||||
|
ctx.fillStyle = pieceColor;
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
|
||||||
|
}
|
||||||
|
function redraw(){
|
||||||
|
ctx.fillStyle = backColor;
|
||||||
|
ctx.fillRect(0,0,drawWidth,500);
|
||||||
|
ctx.fillStyle = pieceColor;
|
||||||
|
for(var t = 0;t<tas.length;t++){//Pour chaque tas (t)
|
||||||
|
for(var i = 0;i<tas[t].length;i++){//Pour chaque piece du tas (i du tas t)
|
||||||
|
L = getWidthFromSize(tas[t][i]);
|
||||||
|
oldX = Math.round(X[t]- (L/2));
|
||||||
|
oldY = Math.round(Y-(pieceHeigth+pieceLevitation)*(tas[t].length-i));
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deplacer(a,b){
|
||||||
|
document.getElementById('out').innerHTML=a+'->'+b;
|
||||||
|
da=a;
|
||||||
|
db=b;
|
||||||
|
L = getWidthFromSize(tas[da][0]);
|
||||||
|
topY = Math.round(Yhigh-pieceHeigth/2);
|
||||||
|
endX = X[db] - L/2;
|
||||||
|
endY = Math.round(Y-(pieceHeigth+pieceLevitation)*(tas[db].length + 1));
|
||||||
|
oldX = Math.round(X[da]- (L/2));
|
||||||
|
oldY = Math.round(Y-(pieceHeigth+pieceLevitation)*(tas[da].length));
|
||||||
|
ctx.fillStyle = backColor;
|
||||||
|
ctx.fillRect(oldX,oldY,L,pieceHeigth);
|
||||||
|
setTimeout(pieceAscending,entreDeux);//TODO timeout variatisation
|
||||||
|
}
|
||||||
|
|
||||||
|
function finishDeplacing(){
|
||||||
|
tas[db].unshift(tas[da][0]);
|
||||||
|
tas[da].shift();
|
||||||
|
moves.shift();
|
||||||
|
if(moves.length>0){
|
||||||
|
console.log(moves[0][0]+'->'+moves[0][1]);
|
||||||
|
setTimeout(function(){deplacer(moves[0][0],moves[0][1]);},entreDeux);
|
||||||
|
//redraw();
|
||||||
|
}else{
|
||||||
|
//redraw();
|
||||||
|
console.log("Done !!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
function roundRect(ctx,x,y,width,height,radius,fill,stroke){
|
||||||
|
//console.log('roundRect('+x+','+y+','+width+','+height+')');
|
||||||
|
if(typeof stroke === 'undefined')
|
||||||
|
stroke = true;
|
||||||
|
if(typeof radius === 'undefined')
|
||||||
|
radius = 5;
|
||||||
|
if(typeof radius === 'number')
|
||||||
|
radius = {tl:radius,tr:radius,br:radius,bl:radius};
|
||||||
|
else{
|
||||||
|
var defaultRadius = {tl:0,tr:0,br:0,bl:0};
|
||||||
|
for(var side in defaultRadius)
|
||||||
|
radius[side] = radius[side] || defaultRadius[side];
|
||||||
|
}
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(x+radius.tl, y);
|
||||||
|
ctx.lineTo(x+width-radius.tr, y);
|
||||||
|
ctx.quadraticCurveTo(x+width,y,x+width,y+radius.tr);
|
||||||
|
ctx.lineTo(x+width, y+height-radius.br);
|
||||||
|
ctx.quadraticCurveTo(x+width,y+height,x+width-radius.br,y+height);
|
||||||
|
ctx.lineTo(x+radius.bl, y+height);
|
||||||
|
ctx.quadraticCurveTo(x,y+height,x,y+height-radius.br);
|
||||||
|
ctx.lineTo(x, y+radius.tl);
|
||||||
|
ctx.quadraticCurveTo(x,y,x+radius.tl,y);
|
||||||
|
ctx.closePath();
|
||||||
|
if(fill)
|
||||||
|
ctx.fill();
|
||||||
|
if(stroke)
|
||||||
|
ctx.stroke();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
60
allein/univers.php
Normal file
60
allein/univers.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
Si vous le voulez , vous pouvez essayer de trouver le code html de votre page web là dedans:<br/>
|
||||||
|
<samp id="universe_text"></samp>
|
||||||
|
|
||||||
|
<div id="add_universe" style="width:34px;height:21px;">
|
||||||
|
Plus
|
||||||
|
</div><br/>
|
||||||
|
<span id="progress"></span><br/>
|
||||||
|
<div id="egg" style="color:#222;">
|
||||||
|
egg
|
||||||
|
</div><br/>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
|
<script src="http://peterolson.github.com/BigInteger.js/BigInteger.min.js"></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function sleep(milliseconds) {
|
||||||
|
var start = new Date().getTime();
|
||||||
|
for (var i = 0; i < 1e7; i++) {
|
||||||
|
if ((new Date().getTime() - start) > milliseconds){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var chars = ['a','z','e','r','t','y','u','i','o','p','q','s','d','f','g','h','j','k','l','m','w','x','c','v','b','n', 'A','Z','E','R','T','Y','U','I','O','P','Q','S','D','F','G','H','J','K','L','M','W','X','C','V','B','N', '1','2','3','4','5','6','7','8','9','0','?',',',';','.','/',':','!','&','"','<','>','#','{','(','[','-','|','\\','_','@',')',']','=','}','+',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '];
|
||||||
|
var charsMaxPerPlus = 5000;
|
||||||
|
var n = bigInt.one;
|
||||||
|
var clics = bigInt.one;
|
||||||
|
var mode = 'txt';
|
||||||
|
var textToAdd = '';
|
||||||
|
|
||||||
|
function addOneUniverseText(){
|
||||||
|
textToAdd += bigInt(2).pow(n).toString();
|
||||||
|
n = n.add(1);
|
||||||
|
$('#progress').text(textToAdd.length + '/' + clics.multiply(charsMaxPerPlus));
|
||||||
|
txtToAdd = 0;
|
||||||
|
if(textToAdd.length < clics.multiply(charsMaxPerPlus))setTimeout(addOneUniverseText,1);
|
||||||
|
else {
|
||||||
|
for(var i = 0;i<textToAdd.length/2;i+=2)
|
||||||
|
txtToAdd += chars[parseInt(textToAdd.substring(i,i+2))];
|
||||||
|
document.getElementById("universe_text").innerHTML += txtToAdd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var plus = document.getElementById('add_universe');
|
||||||
|
plus.addEventListener('click',function(){
|
||||||
|
textToAdd = '';
|
||||||
|
clics = clics.add(1);
|
||||||
|
setTimeout(addOneUniverseText,1)
|
||||||
|
});
|
||||||
|
|
||||||
|
var egg = document.getElementById('egg');
|
||||||
|
egg.addEventListener('click',function(){
|
||||||
|
clics = clics.add(500);
|
||||||
|
});
|
||||||
|
|
||||||
|
addOneUniverseText();
|
||||||
|
</script>
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
include_once 'includes/inter.php';
|
|
||||||
$return = changePassword();
|
|
||||||
if($return = 'falsePassword'){
|
|
||||||
$_SESSION['current_error'] = 'Le mot de passe que vous avez rentré ne correspond pas à celui stoqué dans notre base de données !';
|
|
||||||
header('Location:profile.php');
|
|
||||||
exit;
|
|
||||||
}else if($return = 'passwordMissmatch'){
|
|
||||||
$_SESSION['current_error'] = 'Le nouveau mot de passe et sa confirmation ne correspondent pas';
|
|
||||||
header('Location:profile.php');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<?php include 'includes/meta.php'; ?>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php include 'includes/header.php'; ?>
|
|
||||||
<div id="passwordChangedText">Votre mot de passe à bien été changé !</div>
|
|
||||||
<?php include 'includes/footer.php'; ?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
146
clazz/Article.class.php
Normal file
146
clazz/Article.class.php
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
<?php
|
||||||
|
class Article {
|
||||||
|
|
||||||
|
protected $ID;
|
||||||
|
protected $title;
|
||||||
|
protected $short;
|
||||||
|
protected $text;
|
||||||
|
protected $postDate;
|
||||||
|
protected $lastNoticeableChangeDate;
|
||||||
|
protected $lastChange;
|
||||||
|
protected $picPath;
|
||||||
|
|
||||||
|
protected $valid;
|
||||||
|
|
||||||
|
public function __construct($ID) {
|
||||||
|
$this->ID = $ID;
|
||||||
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM articles WHERE ID=?');
|
||||||
|
$req->execute(array($ID));
|
||||||
|
if($rep = $req->fetch()){
|
||||||
|
$this->valid = TRUE;
|
||||||
|
$this->title = $rep['title'];
|
||||||
|
$this->short = $rep['short'];
|
||||||
|
$this->text = $rep['text'];
|
||||||
|
$this->postDate = $rep['postDate'];
|
||||||
|
$this->lastNoticeableChangeDate = $rep['lastNoticeableChangeDate'];
|
||||||
|
$this->lastChange = $rep['lastChange'];
|
||||||
|
$this->picPath = $rep['picPath'];
|
||||||
|
}else{
|
||||||
|
$this->valid = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString(){
|
||||||
|
$out = 'MegaStockage\n';
|
||||||
|
$out .= '\tID:' . $this->ID . '\n';
|
||||||
|
$out .= '\tTitle:' . $this->title . '\n';
|
||||||
|
$out .= '\tShort description' . $this->short . '\n';
|
||||||
|
$out .= '\tText:' . $this->text . '\n';
|
||||||
|
$out .= '\tPost article date:' . $this->postDate . '\n';
|
||||||
|
$out .= '\tLast noticeable change date:' . $this->lastNoticeableChangeDate . '\n';
|
||||||
|
$out .= '\tLast change date:' . $this->lastChangeDate . '\n';
|
||||||
|
$out .= '\tPic(ture) path:' . $this->picPath . '\n';
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exists(){
|
||||||
|
return $this->valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Getters
|
||||||
|
|
||||||
|
public function getID(){
|
||||||
|
return $this->ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setID($ID){
|
||||||
|
$this->ID = $ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle(){
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTitle($title){
|
||||||
|
$this->title = $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getShort(){
|
||||||
|
return $this->short;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShort($short){
|
||||||
|
$this->short = $short;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getText(){
|
||||||
|
return $this->text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setText($text){
|
||||||
|
$this->text = $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostDate(){
|
||||||
|
return $this->postDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPostDate($postDate){
|
||||||
|
$this->postDate = $postDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLastNoticeableChangeDate(){
|
||||||
|
return $this->lastNoticeableChangeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLastNoticeableChangeDate($lastNoticeableChangeDate){
|
||||||
|
$this->lastNoticeableChangeDate = $lastNoticeableChangeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLastChange(){
|
||||||
|
return $this->lastChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLastChange($lastChange){
|
||||||
|
$this->lastChange = $lastChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPicPath(){
|
||||||
|
return $this->picPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPicPath($picPath){
|
||||||
|
$this->picPath = $picPath;
|
||||||
|
}
|
||||||
|
//Useful getters
|
||||||
|
|
||||||
|
//Gross getters
|
||||||
|
public static function getNewest($count){
|
||||||
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM articles ORDER BY lastNoticeableChangeDate DESC LIMIT '.intval($count));
|
||||||
|
$req->execute();
|
||||||
|
$reps = array();
|
||||||
|
$GLOBALS['bdd']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
while($rep = $req->fetch()){
|
||||||
|
$reps[] = new Article($rep['ID']);
|
||||||
|
}
|
||||||
|
return $reps;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Setters
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
//Operateurs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Outputs texts
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ class Discussion{
|
|||||||
if($rep = $req->fetch()){
|
if($rep = $req->fetch()){
|
||||||
$this->valid = TRUE;
|
$this->valid = TRUE;
|
||||||
$this->name = $rep['name'];
|
$this->name = $rep['name'];
|
||||||
$this->creatorID = new Membre($rep['creatorID']);
|
$this->creator = new Membre($rep['creatorID']);
|
||||||
$this->dateCreation = $rep['dateCreation'];
|
$this->dateCreation = $rep['dateCreation'];
|
||||||
$this->accessibility = $rep['accessibility'];
|
$this->accessibility = $rep['accessibility'];
|
||||||
}else{
|
}else{
|
||||||
@ -35,7 +35,7 @@ class Discussion{
|
|||||||
$out .= '\tCreator:{' . substr(str_replace('\n\t',';',$this->creator->__toString()),0,-1) . '}\n';
|
$out .= '\tCreator:{' . substr(str_replace('\n\t',';',$this->creator->__toString()),0,-1) . '}\n';
|
||||||
$out .= '\tDate of creation:' . $this->dateCreation . '\n';
|
$out .= '\tDate of creation:' . $this->dateCreation . '\n';
|
||||||
$out .= '\tAccessibility:' . $this->accessibility . '\n';
|
$out .= '\tAccessibility:' . $this->accessibility . '\n';
|
||||||
return out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters
|
//Getters
|
||||||
@ -48,7 +48,7 @@ class Discussion{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCreator(){
|
public function getCreator(){
|
||||||
return $creator;
|
return $this->creator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDateCreation(){
|
public function getDateCreation(){
|
||||||
@ -62,13 +62,24 @@ class Discussion{
|
|||||||
|
|
||||||
//Useful Getters
|
//Useful Getters
|
||||||
public function canAccess($membre){
|
public function canAccess($membre){
|
||||||
$out = $this->accessibility === 'p';
|
if($this->accessibility === 'p')
|
||||||
$out = $out or $membre->getID() === $this->creator->getID();
|
return TRUE;
|
||||||
|
if($membre->getID() === $this->creator->getID())
|
||||||
|
return TRUE;
|
||||||
if(preg_match ( "#^a[0-9]+$#", $this->accessibility ) == 1)
|
if(preg_match ( "#^a[0-9]+$#", $this->accessibility ) == 1)
|
||||||
$out = $out or intval ( substr ( $this->accessibility, 1 ) ) <= $membre->getAdminLevel();
|
if(intval ( substr ( $this->accessibility, 1 ) ) <= $membre->getAdminLevel())
|
||||||
$out = $out or preg_match ( '#^x([0-9]+;)*' . $membre->getID() . '(;[0-9]+)*$#', $disc ['autorized'] ) == 1;
|
return TRUE;
|
||||||
$out = $out or $membre->getAdminLevel() >= 14;
|
if(preg_match ( '#^x([0-9]+,)*' . $membre->getID() . '(,[0-9]+)*$#', $this->accessibility ))
|
||||||
return $out;
|
return TRUE;
|
||||||
|
if($membre->getAdminLevel() >= 14)
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isPublic(){
|
||||||
|
if($this->accessibility === 'p')
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -130,37 +141,43 @@ class Discussion{
|
|||||||
public static function getFromName($name){
|
public static function getFromName($name){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE name=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE name=?');
|
||||||
$req->execute(array($name));
|
$req->execute(array($name));
|
||||||
return discussionGetterOutput($req);
|
return Discussion::discussionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromCreator($creator){
|
public static function getFromCreator($creator){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
|
||||||
$req->execute(array($creator->getID()));
|
$req->execute(array($creator->getID()));
|
||||||
return discussionGetterOutput($req);
|
return Discussion::discussionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromDateCreation($date){
|
public static function getFromDateCreation($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation=?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return discussionGetterOutput($req);
|
return Discussion::discussionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromAccessibility($accessibility){
|
public static function getFromAccessibility($accessibility){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
|
||||||
$req->execute(array($accessibility));
|
$req->execute(array($accessibility));
|
||||||
return discussionGetterOutput($req);
|
return Discussion::discussionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCreatedLaterThan($date){
|
public static function getCreatedLaterThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation>?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation>?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return discussionGetterOutput($req);
|
return Discussion::discussionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCreatedEarlierThan($date){
|
public static function getCreatedEarlierThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation<?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation<?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return discussionGetterOutput($req);
|
return Discussion::discussionGetterOutput($req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPublics(){
|
||||||
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE accessibility LIKE "p%"');
|
||||||
|
$req->execute();
|
||||||
|
return Discussion::discussionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getWhichHeCanAccess($he){
|
public static function getWhichHeCanAccess($he){
|
||||||
@ -170,7 +187,7 @@ class Discussion{
|
|||||||
$out = array();
|
$out = array();
|
||||||
while ( $rep = $req->fetch()) {
|
while ( $rep = $req->fetch()) {
|
||||||
$disc = new Discussion($rep['ID']);
|
$disc = new Discussion($rep['ID']);
|
||||||
if ($disc->canAccess($membre))
|
if ($disc->canAccess($he))
|
||||||
$out[] = $disc;
|
$out[] = $disc;
|
||||||
}
|
}
|
||||||
if($out)
|
if($out)
|
||||||
@ -178,6 +195,24 @@ class Discussion{
|
|||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
//Discussion creator
|
||||||
|
public static function createDiscussion($name, $owner) {
|
||||||
|
if(Discussion::getFromName($name))
|
||||||
|
return Discussion::NAME_ALREADY_USED;
|
||||||
|
if(strlen($name)>255)
|
||||||
|
return Discussion::TOO_LONG_NAME;
|
||||||
|
$regex = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 éèàμ_\\-\'()\\[\\]\\\\/,;:.§!ù%£$¤=+\\-*\\#~"|ç@';
|
||||||
|
$regex = '#^['.$regex.']+$#';
|
||||||
|
if(preg_match($regex,$name) != 1)
|
||||||
|
return Discussion::ILLEGAL_NAME;
|
||||||
|
$req = $GLOBALS ['bdd']->prepare ("INSERT INTO `discussions`(`ID`, `name`, `creatorID`, `dateCreation`, `accessibility`) VALUES (NULL,?,?,NOW(),'p')" );
|
||||||
|
$req->execute ( array (
|
||||||
|
$name,
|
||||||
|
$owner
|
||||||
|
) );
|
||||||
|
return 'ok';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Exceptions texts
|
// Exceptions texts
|
||||||
|
|
||||||
@ -196,4 +231,4 @@ class Discussion{
|
|||||||
//setDateCreation()
|
//setDateCreation()
|
||||||
const MALFORMED_DATE = 'La date de création doit être de la forme "AAAA:MM:JJ hh:mm:ss"';
|
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';
|
const DATE_CREATION_CHANGED = 'La date de création a bien été changée';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ class Langage{
|
|||||||
public static $java;
|
public static $java;
|
||||||
public static $vba;
|
public static $vba;
|
||||||
|
|
||||||
protected static $languages = array();
|
public static $languages = array();
|
||||||
|
|
||||||
protected $ID;
|
protected $ID;
|
||||||
protected $name;
|
protected $name;
|
||||||
@ -16,7 +16,7 @@ class Langage{
|
|||||||
$this->ID = $ID;
|
$this->ID = $ID;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->avalivableFiles = explode(" ",$avalivableFiles);
|
$this->avalivableFiles = explode(" ",$avalivableFiles);
|
||||||
$languages[] = $this;
|
Langage::$languages[] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getID(){
|
public function getID(){
|
||||||
@ -45,12 +45,20 @@ class Langage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromID($ID){
|
public static function getFromID($ID){
|
||||||
foreach(self::$languages AS $language){
|
foreach(Langage::$languages AS $language){
|
||||||
if($language->getID() == $ID)
|
if($language->getID() == $ID)
|
||||||
return $language;
|
return $language;
|
||||||
}
|
}
|
||||||
|
//var_dump(Langage::$languages);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
public static function getLanguagesFromVersions($versions){
|
||||||
|
$languages = array();
|
||||||
|
foreach($versions AS $version)
|
||||||
|
array_push($languages,$version->getLanguage());
|
||||||
|
$languages = array_unique($languages,SORT_REGULAR);
|
||||||
|
return $languages;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Langage::$java = new Langage(0, "Java", "jar java javadoc");
|
Langage::$java = new Langage(0, "Java", "jar java javadoc");
|
||||||
|
|||||||
327
clazz/MegaStockage.class.php
Normal file
327
clazz/MegaStockage.class.php
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
<?php
|
||||||
|
class Membre {
|
||||||
|
|
||||||
|
protected $ID;
|
||||||
|
protected $accountID;
|
||||||
|
protected $accountPassword;
|
||||||
|
protected $owner;
|
||||||
|
protected $liberties;// [ [ read , read ],[ write , write ] ]
|
||||||
|
protected $path;
|
||||||
|
protected $size;
|
||||||
|
|
||||||
|
protected $valid;
|
||||||
|
|
||||||
|
public function __construct($ID) {
|
||||||
|
$this->ID = $ID;
|
||||||
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM megaStockages WHERE ID=?');
|
||||||
|
$req->execute(array($ID));
|
||||||
|
if($rep = $req->fetch()){
|
||||||
|
$this->valid = TRUE;
|
||||||
|
$this->accountID = $rep['accountID'];
|
||||||
|
$this->accountPassword = $rep['accountPassword'];
|
||||||
|
$this->owner = new Membre($rep['owner']);
|
||||||
|
$this->liberties = /* TODO parse liberties */$rep['liberties'];
|
||||||
|
$this->path = $rep['path'];
|
||||||
|
$this->size = $rep['size'];
|
||||||
|
}else{
|
||||||
|
$this->valid = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString(){
|
||||||
|
$out = 'MegaStockage\n';
|
||||||
|
$out .= '\tID:' . $this->ID . '\n';
|
||||||
|
$out .= '\tAccount ID:' . $this->accountID . '\n';
|
||||||
|
$out .= '\tAccount password' . $this->adminLevel . '\n';
|
||||||
|
$out .= '\tOwner:' . $this->owner->__toString() . '\n';
|
||||||
|
$out .= '\tLiberties:' . $this->liberties . '\n';
|
||||||
|
$out .= '\tPath:' . $this->path . '\n';
|
||||||
|
$out .= '\tSize:' . $this->size . '\n';
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function exists(){
|
||||||
|
return $this->valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Getters
|
||||||
|
//TODO gen getters
|
||||||
|
|
||||||
|
//Useful getters
|
||||||
|
public function canRead($he){
|
||||||
|
$read = $this->liberties[0];
|
||||||
|
if($read=='public')
|
||||||
|
return TRUE;
|
||||||
|
else if(in_array($he->getID(),$read)
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
public function canWrite($he){
|
||||||
|
$write = $this->liberties[1];
|
||||||
|
if($write=='public')
|
||||||
|
return TRUE;
|
||||||
|
else if(in_array($he->getID(),$write)
|
||||||
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Setters
|
||||||
|
public function setAttribute($attribute,$value,$valueType){
|
||||||
|
//TODO todo
|
||||||
|
$json=FALSE;
|
||||||
|
switch ($attribute){
|
||||||
|
case 'ID':
|
||||||
|
if($valueType !== '0'){
|
||||||
|
echo 'Error : the type "'.$valueType.'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = intval($value);
|
||||||
|
break;
|
||||||
|
case 'pseudo':
|
||||||
|
if($valueType !== '"'){
|
||||||
|
echo 'Error : the type "'.$valueType.'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($value).'"';
|
||||||
|
break;
|
||||||
|
case 'hashedPseudo':
|
||||||
|
if($valueType !== '"'){
|
||||||
|
echo 'Error : the type "'.$valueType.'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($value).'"';
|
||||||
|
break;
|
||||||
|
case 'adminLevel':
|
||||||
|
if($valueType !== '0'){
|
||||||
|
echo 'Error : the type "'.$valueType.'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = intval($value);
|
||||||
|
break;
|
||||||
|
case 'dateCreation':
|
||||||
|
if($valueType !== '"'){
|
||||||
|
echo 'Error : the type "'.$valueType.'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.$value.'"';
|
||||||
|
break;
|
||||||
|
case 'requiredBanner'://FIXME jsonMysqlProblem
|
||||||
|
$json=TRUE;
|
||||||
|
if($valueType !== '"'){
|
||||||
|
echo 'Error : the type "'.$valueType.'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($value).'"';
|
||||||
|
break;
|
||||||
|
case 'personnalMessage':
|
||||||
|
$json=TRUE;
|
||||||
|
if($valueType !== '"'){
|
||||||
|
echo 'Error : the type "'.$valueType.'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($value).'"';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo 'Undefined attribute "'.$attribute.'" for the class Membre';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$restrictionValues[] = $value;
|
||||||
|
if($json){
|
||||||
|
//TODO Set command for json
|
||||||
|
}else{
|
||||||
|
$command = 'UPDATE membres SET ' . $attribute . '=' . $value . ' WHERE ID=' . $this->ID;
|
||||||
|
}
|
||||||
|
echo $command.'</br>';
|
||||||
|
$req = $GLOBALS['bdd']->prepare($command);
|
||||||
|
$req->execute(array());
|
||||||
|
if($req->errorInfo()[0] != 0){
|
||||||
|
echo 'Eine MYSQL Exception hat geworft. Einschuldigung';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Objects which matchs the specified restrictions
|
||||||
|
*/
|
||||||
|
public static function getFromAttributes($restrictions){
|
||||||
|
$whereCommands = array();
|
||||||
|
$restrictionValues = array();
|
||||||
|
foreach ($restrictions as $restriction){
|
||||||
|
$whereCommand = NULL;
|
||||||
|
$attribute = $restriction[0];
|
||||||
|
$json = FALSE;
|
||||||
|
$operator = NULL;
|
||||||
|
$value = NULL;
|
||||||
|
try {
|
||||||
|
switch ($attribute){
|
||||||
|
case 'ID':
|
||||||
|
if($restriction[2][0] !== '0'){
|
||||||
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = intval($restriction[2][1]);
|
||||||
|
$operator = Utility::getIntegerSqlOperator($restriction[1]);
|
||||||
|
break;
|
||||||
|
case 'pseudo':
|
||||||
|
if($restriction[2][0] !== '"'){
|
||||||
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($restriction[2][1]).'"';
|
||||||
|
$operator = Utility::getStringSqlOperator($restriction[1]);
|
||||||
|
break;
|
||||||
|
case 'hashedPseudo':
|
||||||
|
if($restriction[2][0] !== '"'){
|
||||||
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($restriction[2][1]).'"';
|
||||||
|
$operator = Utility::getStringSqlOperator($restriction[1]);
|
||||||
|
break;
|
||||||
|
case 'adminLevel':
|
||||||
|
if($restriction[2][0] !== '0'){
|
||||||
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = intval($restriction[2][1]);
|
||||||
|
$operator = Utility::getIntegerSqlOperator($restriction[1]);
|
||||||
|
break;
|
||||||
|
case 'dateCreation':
|
||||||
|
if($restriction[2][0] !== '"'){//TODO add type date
|
||||||
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.$restriction[2][1].'"';
|
||||||
|
$operator = Utility::getDateSqlOperator($restriction[1]);
|
||||||
|
break;
|
||||||
|
case 'requiredBanner'://FIXME jsonMysqlProblem
|
||||||
|
$json=TRUE;
|
||||||
|
if($restriction[2][0] !== '"'){
|
||||||
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($restriction[2][1]).'"';
|
||||||
|
$operator = Utility::getStringSqlOperator($restriction[1]);
|
||||||
|
break;
|
||||||
|
case 'personnalMessage':
|
||||||
|
$json=TRUE;
|
||||||
|
if($restriction[2][0] !== '"'){
|
||||||
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$value = '"'.strval($restriction[2][1]).'"';
|
||||||
|
$operator = Utility::getStringSqlOperator($restriction[1]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo 'Undefined attribute "'.$attribute.'" for the class Membre';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}catch(InvalidOperatorException $e){
|
||||||
|
echo $e->getMessage().' when reading attribute "'.$attribute.'"';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$restrictionValues[] = $value;
|
||||||
|
if($json){
|
||||||
|
$whereCommand = '((data->"$.'.$attribute.'" IS NOT NULL) AND (data->"$.'.$attribute.'" '.$operator.' ? ))';
|
||||||
|
}else{
|
||||||
|
$whereCommand = $attribute . ' ' . $operator . ' ' . $value;
|
||||||
|
}
|
||||||
|
$whereCommands[] = $whereCommand;
|
||||||
|
}
|
||||||
|
$wherePart = "";
|
||||||
|
if(count($whereCommands) >0)
|
||||||
|
$wherePart = 'WHERE '.implode(' AND ',$whereCommands);
|
||||||
|
|
||||||
|
$command = 'SELECT * FROM membres '.$wherePart;
|
||||||
|
$req = $GLOBALS['bdd']->prepare($command);
|
||||||
|
$req->execute($restrictionValues);
|
||||||
|
echo $command.'</br>';
|
||||||
|
if($req->errorInfo()[0] != 0)
|
||||||
|
echo 'Erreur SQL, veuillez verifier les selecteurs';
|
||||||
|
$out = array();
|
||||||
|
while($rep = $req->fetch())
|
||||||
|
$out[] = new Membre($rep['ID']);
|
||||||
|
|
||||||
|
//Choose return value
|
||||||
|
switch(count($out)){
|
||||||
|
case 0:
|
||||||
|
return NULL;
|
||||||
|
case 1:
|
||||||
|
return $out[0];
|
||||||
|
default:
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFromPseudo($pseudo){
|
||||||
|
return Membre::getFromAttributes(array(['pseudo','=',['"',$pseudo]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFromAdminLevel($level){
|
||||||
|
return Membre::getFromAttributes(array(['adminLevel','=',['0',$level]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFromDateCreation($date){
|
||||||
|
return Membre::getFromAttributes(array(['dateCreation','=',['0',$date]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCreatedLaterThan($date){
|
||||||
|
return Membre::getFromAttributes(array(['dateCreation','>',['"',$date]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCreatedEarlierThan($date){
|
||||||
|
return Membre::getFromAttributes(array(['dateCreation','<',['"',$date]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAdminGreaterThan($min){
|
||||||
|
return Membre::getFromAttributes(array(['adminLevel','>',['0',$min]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAdminLowerThan($max){
|
||||||
|
return Membre::getFromAttributes(array(['adminLevel','<',['0',$max]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function me(){
|
||||||
|
if(!isset($_SESSION['session_id']))
|
||||||
|
return NULL;
|
||||||
|
$me = new Membre($_SESSION['session_id']);
|
||||||
|
if(!$me->exists())
|
||||||
|
return NULL;
|
||||||
|
return $me;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//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::PERSON_REGISTERED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Operateurs
|
||||||
|
public function __is_identical($copain){
|
||||||
|
return $this->getID() == $copain->getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//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 !';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class Membre {
|
|||||||
$out .= '\tDate of creation:' . $this->dateCreation . '\n';
|
$out .= '\tDate of creation:' . $this->dateCreation . '\n';
|
||||||
$out .= '\tRequired banner:' . $this->requiredBanner . '\n';
|
$out .= '\tRequired banner:' . $this->requiredBanner . '\n';
|
||||||
$out .= '\tPersonnal message:' . $this->personnalMessage . '\n';
|
$out .= '\tPersonnal message:' . $this->personnalMessage . '\n';
|
||||||
return out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isConnected(){
|
public function isConnected(){
|
||||||
@ -95,7 +95,7 @@ class Membre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function isAdminLevelGreaterThan($min){
|
public function isAdminLevelGreaterThan($min){
|
||||||
return $this->adminLevel>$max;
|
return $this->adminLevel>$min;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAdminLevelLowerOrEqualThan($max){
|
public function isAdminLevelLowerOrEqualThan($max){
|
||||||
@ -120,7 +120,7 @@ class Membre {
|
|||||||
public function changePassword($newPassword){
|
public function changePassword($newPassword){
|
||||||
if(strlen($newPassword)>255)
|
if(strlen($newPassword)>255)
|
||||||
return Membre::PASSWORD_TOO_LONG;
|
return Membre::PASSWORD_TOO_LONG;
|
||||||
$req = $GLOBALS['bdd']->prepare('UPDATE membres SET mdp=? WHERE ID=?');
|
$req = $GLOBALS['bdd']->prepare('UPDATE membres SET hashedPassword=? WHERE ID=?');
|
||||||
$req->execute(array(password_hash ( $newPassword, PASSWORD_DEFAULT ),$this->ID));
|
$req->execute(array(password_hash ( $newPassword, PASSWORD_DEFAULT ),$this->ID));
|
||||||
return Membre::PASSWORD_CHANGED;
|
return Membre::PASSWORD_CHANGED;
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ class Membre {
|
|||||||
$operator = Utility::getIntegerSqlOperator($restriction[1]);
|
$operator = Utility::getIntegerSqlOperator($restriction[1]);
|
||||||
break;
|
break;
|
||||||
case 'dateCreation':
|
case 'dateCreation':
|
||||||
if($restriction[2][0] !== '"'){
|
if($restriction[2][0] !== '"'){//TODO add type date
|
||||||
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
echo 'Error : the type "'.$restriction[2][0].'" is not allowed for the attribute '.$attribute;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -316,31 +316,40 @@ class Membre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromPseudo($pseudo){
|
public static function getFromPseudo($pseudo){
|
||||||
return getFromAttributes(array(['pseudo','=',$pseudo]));
|
return Membre::getFromAttributes(array(['pseudo','=',['"',$pseudo]]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromAdminLevel($level){
|
public static function getFromAdminLevel($level){
|
||||||
return getFromAttributes(array(['adminLevel','=',$level]));
|
return Membre::getFromAttributes(array(['adminLevel','=',['0',$level]]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromDateCreation($date){
|
public static function getFromDateCreation($date){
|
||||||
return getFromAttributes(array(['dateCreation','=',$date]));
|
return Membre::getFromAttributes(array(['dateCreation','=',['0',$date]]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCreatedLaterThan($date){
|
public static function getCreatedLaterThan($date){
|
||||||
return getFromAttributes(array(['dateCreation','>',$date]));
|
return Membre::getFromAttributes(array(['dateCreation','>',['"',$date]]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCreatedEarlierThan($date){
|
public static function getCreatedEarlierThan($date){
|
||||||
return getFromAttributes(array(['dateCreation','<',$date]));
|
return Membre::getFromAttributes(array(['dateCreation','<',['"',$date]]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAdminGreaterThan($min){
|
public static function getAdminGreaterThan($min){
|
||||||
return getFromAttributes(array(['adminLevel','>',$min]));
|
return Membre::getFromAttributes(array(['adminLevel','>',['0',$min]]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAdminLowerThan($max){
|
public static function getAdminLowerThan($max){
|
||||||
return getFromAttributes(array(['adminLevel','<',$max]));
|
return Membre::getFromAttributes(array(['adminLevel','<',['0',$max]]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function me(){
|
||||||
|
if(!isset($_SESSION['session_id']))
|
||||||
|
return NULL;
|
||||||
|
$me = new Membre($_SESSION['session_id']);
|
||||||
|
if(!$me->exists())
|
||||||
|
return NULL;
|
||||||
|
return $me;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -352,6 +361,11 @@ class Membre {
|
|||||||
$req->execute (array($pseudo,password_hash( $mdp, PASSWORD_DEFAULT)));
|
$req->execute (array($pseudo,password_hash( $mdp, PASSWORD_DEFAULT)));
|
||||||
return Membre::PERSON_REGISTERED;
|
return Membre::PERSON_REGISTERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Operateurs
|
||||||
|
public function __is_identical($copain){
|
||||||
|
return $this->getID() == $copain->getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Outputs texts
|
//Outputs texts
|
||||||
|
|||||||
@ -16,8 +16,8 @@ class Message{
|
|||||||
if($rep = $req->fetch()){
|
if($rep = $req->fetch()){
|
||||||
$this->valid = TRUE;
|
$this->valid = TRUE;
|
||||||
$this->sender = new Membre($rep['senderID']);
|
$this->sender = new Membre($rep['senderID']);
|
||||||
$this->sendDate = $rep['sendDate'];
|
$this->sendDate = $rep['sendTime'];
|
||||||
$this->text = $rep['text'];
|
$this->text = $rep['texte'];
|
||||||
$this->discussion = new Discussion($rep['discussionID']);
|
$this->discussion = new Discussion($rep['discussionID']);
|
||||||
}else{
|
}else{
|
||||||
$this->valid = FALSE;
|
$this->valid = FALSE;
|
||||||
@ -78,7 +78,7 @@ class Message{
|
|||||||
private static function messagesGetterOutput($req){
|
private static function messagesGetterOutput($req){
|
||||||
$out = array();
|
$out = array();
|
||||||
while($rep = $req->fetch())
|
while($rep = $req->fetch())
|
||||||
$out[] = new Discussion($rep['ID']);
|
$out[] = new Message($rep['ID']);
|
||||||
switch(count($out)){
|
switch(count($out)){
|
||||||
case 0:
|
case 0:
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -92,45 +92,52 @@ class Message{
|
|||||||
public static function getFromSender($param) {
|
public static function getFromSender($param) {
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE senderID=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE senderID=?');
|
||||||
$req->execute(array($sender->getID()));
|
$req->execute(array($sender->getID()));
|
||||||
return messagesGetterOutput($req);
|
return Message::messagesGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function getFromSendDate($date){
|
public static function getFromSendDate($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate=?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return messagesGetterOutput($req);
|
return Message::messagesGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSendedLaterThan($date){
|
public static function getSendedLaterThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate>?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate>?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return messagesGetterOutput($req);
|
return Message::messagesGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSendedEarlierThan($date){
|
public static function getSendedEarlierThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate<?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate<?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return messagesGetterOutput($req);
|
return Message::messagesGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromText($text) {
|
public static function getFromText($text) {
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE text=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE text=?');
|
||||||
$req->execute(array($text));
|
$req->execute(array($text));
|
||||||
return messagesGetterOutput($req);
|
return Message::messagesGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromDiscussion($discut){
|
public static function getFromDiscussion($discut){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE discussionID=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE discussionID=?');
|
||||||
$req->execute(array($discut->getID()));
|
$req->execute(array($discut->getID()));
|
||||||
return messagesGetterOutput($req);
|
return Message::messagesGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Message creator
|
//Message creator
|
||||||
public static function sendMessage($sender,$discussion,$text){
|
public static function sendMessage($sender,$discussion,$text){
|
||||||
$req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO messages(discussion_id,texte,senderID,sendTime) VALUES (?,?,?,NOW())' );
|
$req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO messages(discussionID,texte,senderID,sendTime) VALUES (?,?,?,NOW())' );
|
||||||
$req->execute (array($discussion->getID(),htmlspecialchars ($text),$sender->getID()));
|
$req->execute (array($discussion->getID(),htmlspecialchars ($text),$sender->getID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public function removeMessage(){
|
||||||
|
$req = $GLOBALS ['bdd']->prepare ( 'DELETE FROM messages WHERE ID=?' );
|
||||||
|
$req->execute (array($this->getID()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ class Projet{
|
|||||||
protected $dateCreation;
|
protected $dateCreation;
|
||||||
protected $owner;
|
protected $owner;
|
||||||
protected $secondaryOwners;
|
protected $secondaryOwners;
|
||||||
|
protected $publik;
|
||||||
|
|
||||||
protected $valid;
|
protected $valid;
|
||||||
|
|
||||||
@ -19,8 +20,9 @@ class Projet{
|
|||||||
$this->owner = new Membre($rep['ownerID']);
|
$this->owner = new Membre($rep['ownerID']);
|
||||||
$this->dateCreation = $rep['dateCreation'];
|
$this->dateCreation = $rep['dateCreation'];
|
||||||
$this->secondaryOwners = array();
|
$this->secondaryOwners = array();
|
||||||
foreach (explode(';',$rep['secondaryOwners']) AS $secondaryOwner)
|
foreach (explode(';',$rep['secondaryOwnersID']) AS $secondaryOwner)
|
||||||
$this->secondaryOwners[] = new Membre($secondaryOwner);
|
$this->secondaryOwners[] = new Membre($secondaryOwner);
|
||||||
|
$this->publik = $rep['public'];
|
||||||
}else{
|
}else{
|
||||||
$this->valid = FALSE;
|
$this->valid = FALSE;
|
||||||
}
|
}
|
||||||
@ -38,7 +40,7 @@ class Projet{
|
|||||||
foreach($this->secondaryOwners AS $secondaryOwner)
|
foreach($this->secondaryOwners AS $secondaryOwner)
|
||||||
$out .= '\tSecondary owner:{' . substr(str_replace('\n\t',';',$secondaryOwner->__toString()),0,-1) . '}\n';
|
$out .= '\tSecondary owner:{' . substr(str_replace('\n\t',';',$secondaryOwner->__toString()),0,-1) . '}\n';
|
||||||
$out .= '\tDate of creation:' . $this->dateCreation . '\n';
|
$out .= '\tDate of creation:' . $this->dateCreation . '\n';
|
||||||
return out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Getters
|
//Getters
|
||||||
@ -62,10 +64,14 @@ class Projet{
|
|||||||
return $this->dateCreation;
|
return $this->dateCreation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPublic(){
|
||||||
|
return $this->publik == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Useful getters
|
//Useful getters
|
||||||
public function haveRights($member){
|
public function haveRights($member){
|
||||||
return $member->getID() == $owner->getID() or in_array($member,$this->secondaryOwners);
|
return $member->getID() == $this->owner->getID() or in_array($member,$this->secondaryOwners);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Setters
|
//Setters
|
||||||
@ -92,7 +98,7 @@ class Projet{
|
|||||||
private static function projectGetterOutput($req){
|
private static function projectGetterOutput($req){
|
||||||
$out = array();
|
$out = array();
|
||||||
while($rep = $req->fetch())
|
while($rep = $req->fetch())
|
||||||
$out[] = new Project($rep['ID']);
|
$out[] = new Projet($rep['ID']);
|
||||||
switch(count($out)){
|
switch(count($out)){
|
||||||
case 0:
|
case 0:
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -104,19 +110,19 @@ class Projet{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromName($name){
|
public static function getFromName($name){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE name=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets WHERE name=?');
|
||||||
$req->execute(array($name));
|
$req->execute(array($name));
|
||||||
return projectGetterOutput($req);
|
return projectGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromOwner($owner){
|
public static function getFromOwner($owner){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE owner=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets WHERE owner=?');
|
||||||
$req->execute(array($owner->getID()));
|
$req->execute(array($owner->getID()));
|
||||||
return projectGetterOutput($req);
|
return projectGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromSecondaryOwner($secondaryOwner){
|
public static function getFromSecondaryOwner($secondaryOwner){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets');
|
||||||
$req->execute();
|
$req->execute();
|
||||||
$out = array();
|
$out = array();
|
||||||
while ($rep = $req->fetch()) {
|
while ($rep = $req->fetch()) {
|
||||||
@ -141,25 +147,44 @@ class Projet{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getCreatedLaterThan($date){
|
public static function getCreatedLaterThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation>?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets WHERE dateCreation>?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return projectGetterOutput($req);
|
return projectGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCreatedEarlierThan($date){
|
public static function getCreatedEarlierThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project WHERE dateCreation<?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets WHERE dateCreation<?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return projectGetterOutput($req);
|
return projectGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getWhichHeCanAccess($he){
|
public static function getWhichHeCanAccess($he){
|
||||||
//TODO Faire la selection directement grâce à une requette SQL
|
//TODO Faire la selection directement grâce à une requette SQL
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets');
|
||||||
$req->execute(array());
|
$req->execute(array());
|
||||||
$out = array();
|
$out = array();
|
||||||
while ( $rep = $req->fetch()) {
|
while ( $rep = $req->fetch()) {
|
||||||
$projet = new Projet($rep['ID']);
|
$projet = new Projet($rep['ID']);
|
||||||
if ($projet->haveRights($membre))
|
if ($projet->haveRights($he))
|
||||||
|
$out[] = $projet;
|
||||||
|
}
|
||||||
|
switch(count($out)){
|
||||||
|
case 0:
|
||||||
|
return NULL;
|
||||||
|
case 1:
|
||||||
|
return $out[0];
|
||||||
|
default:
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getOthers($he){
|
||||||
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets');
|
||||||
|
$req->execute(array());
|
||||||
|
$out = array();
|
||||||
|
while ( $rep = $req->fetch()) {
|
||||||
|
$projet = new Projet($rep['ID']);
|
||||||
|
if ($he?$he->isAdminLevelGreaterThan(12):FALSE || $projet->isPublic())
|
||||||
$out[] = $projet;
|
$out[] = $projet;
|
||||||
}
|
}
|
||||||
switch(count($out)){
|
switch(count($out)){
|
||||||
@ -173,5 +198,4 @@ class Projet{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
class Projet{
|
|
||||||
protected $ID;
|
|
||||||
protected $name;
|
|
||||||
protected $dateCreation;
|
|
||||||
protected $owner;
|
|
||||||
protected $secondaryOwners;
|
|
||||||
|
|
||||||
protected $valid;
|
|
||||||
|
|
||||||
public function __construct($ID){
|
|
||||||
$this->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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -114,4 +114,10 @@ NOT REGEXP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public static function arrayIfNot($var){
|
||||||
|
if(!is_array($var))
|
||||||
|
return array($var);
|
||||||
|
return $var;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ class Version{
|
|||||||
protected $tags;//String "beta bugged" in bdd , stored as a string array
|
protected $tags;//String "beta bugged" in bdd , stored as a string array
|
||||||
protected $project;
|
protected $project;
|
||||||
protected $language;
|
protected $language;
|
||||||
|
protected $versionAbs;
|
||||||
|
|
||||||
public function __construct($ID){
|
public function __construct($ID){
|
||||||
$this->ID = $ID;
|
$this->ID = $ID;
|
||||||
@ -15,12 +16,13 @@ class Version{
|
|||||||
$req->execute(array($ID));
|
$req->execute(array($ID));
|
||||||
if($rep = $req->fetch()){
|
if($rep = $req->fetch()){
|
||||||
$this->valid = TRUE;
|
$this->valid = TRUE;
|
||||||
$this->name = $rem['name'];
|
$this->name = $rep['name'];
|
||||||
$this->sendDate = $rep['sendDate'];
|
$this->sendDate = $rep['sendDate'];
|
||||||
$this->publicFiles = explode(" ",$rep['publicFiles']);
|
$this->publicFiles = explode(" ",$rep['publicFiles']);
|
||||||
$this->tags = explode(" ",$rep['tags']);
|
$this->tags = explode(" ",$rep['tags']);
|
||||||
$this->project = new Project($rep['projectID']);
|
$this->project = new Projet($rep['projectID']);
|
||||||
$this->language = Langage::getFromID($rep['languageID']);
|
$this->language = Langage::getFromID(intval($rep['languageID']));
|
||||||
|
$this->versionAbs = $rep['versionAbs'];
|
||||||
}else{
|
}else{
|
||||||
$this->valid = FALSE;
|
$this->valid = FALSE;
|
||||||
}
|
}
|
||||||
@ -31,15 +33,21 @@ class Version{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function __toString(){
|
public function __toString(){
|
||||||
$out = 'Version\n';
|
try{
|
||||||
$out .= '\tID:' . $this->ID . '\n';
|
$out = 'Version\n';
|
||||||
$out .= '\tName:{' . $this->name . '}\n';
|
$out .= '\tID:' . $this->ID . '\n';
|
||||||
$out .= '\tSend date:' . $this->sendDate . '\n';
|
$out .= '\tName:{' . $this->name . '}\n';
|
||||||
$out .= '\tPublic files:"' . implode(' ',$this->publicFiles) . '"}\n';
|
$out .= '\tSend date:' . $this->sendDate . '\n';
|
||||||
$out .= '\tTags:"' . implode(' ',$this->tags) . '"}\n';
|
$out .= '\tPublic files:"' . implode(' ',$this->publicFiles) . '"}\n';
|
||||||
$out .= '\tProject:' . substr(str_replace('\n\t',';',$this->project->__toString()),0,-1) . '\n';
|
$out .= '\tTags:"' . implode(' ',$this->tags) . '"}\n';
|
||||||
$out .= '\tLanguage:' . $this->language->getName() . '\n';
|
$out .= '\tProject:' . substr(str_replace('\n\t',';',$this->project->__toString()),0,-1) . '\n';
|
||||||
return out;
|
$out .= '\tLanguage:' . $this->language->getName() . '\n';
|
||||||
|
$out .= '\tVersion absolue:' . $this->versionAbs . '\n';
|
||||||
|
return $out;
|
||||||
|
}catch(Error $e){
|
||||||
|
echo '#' . $this->language . "#";
|
||||||
|
return $e->__toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,6 +82,10 @@ class Version{
|
|||||||
return $this->language;
|
return $this->language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getVersionAbs(){
|
||||||
|
return $this->versionAbs;
|
||||||
|
}
|
||||||
|
|
||||||
//Useful Getters
|
//Useful Getters
|
||||||
//TODO make all of the following 'is' functions using haveTag
|
//TODO make all of the following 'is' functions using haveTag
|
||||||
public function haveTag($tag){
|
public function haveTag($tag){
|
||||||
@ -249,19 +261,25 @@ class Version{
|
|||||||
public static function getFromLanguage($language){
|
public static function getFromLanguage($language){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE languageID=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE languageID=?');
|
||||||
$req->execute(array($language->getID()));
|
$req->execute(array($language->getID()));
|
||||||
return versionGetterOutput($req);
|
return Version::versionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromProject($project){
|
public static function getFromProject($project){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE projectID=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE projectID=?');
|
||||||
$req->execute(array($project->getID()));
|
$req->execute(array($project->getID()));
|
||||||
return versionGetterOutput($req);
|
return Version::versionGetterOutput($req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getHighestFromProject($project){
|
||||||
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE projectID=? and versionAbs=(SELECT MAX(versionAbs) FROM versions WHERE projectID=?)');
|
||||||
|
$req->execute(array($project->getID(),$project->getID()));
|
||||||
|
return Version::versionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromName($name){
|
public static function getFromName($name){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE name=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE name=?');
|
||||||
$req->execute(array($name));
|
$req->execute(array($name));
|
||||||
return versionGetterOutput($req);
|
return Version::versionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromTag($tag){
|
public static function getFromTag($tag){
|
||||||
@ -282,31 +300,28 @@ class Version{
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
return projectGetterOutput($req);
|
return Version::versionGetterOutput($req);
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE languageID=?');
|
|
||||||
$req->execute(array($language->getID()));
|
|
||||||
return versionGetterOutput($req);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromSendDate($date){
|
public static function getFromSendDate($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate=?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate=?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return versionsGetterOutput($req);
|
return Version::versionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSendedLaterThan($date){
|
public static function getSendedLaterThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate>?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate>?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return versionsGetterOutput($req);
|
return Version::versionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSendedEarlierThan($date){
|
public static function getSendedEarlierThan($date){
|
||||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate<?');
|
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate<?');
|
||||||
$req->execute(array($date));
|
$req->execute(array($date));
|
||||||
return versionsGetterOutput($req);
|
return Version::versionGetterOutput($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
//$GLOBALS['bdd'] = new PDO('mysql:host=127.0.0.1;dbname=u890869027_bcom;charset=utf8', 'u890869027', '*******************');
|
||||||
$GLOBALS['bdd'] = new PDO('mysql:host=mysql.hostinger.fr;dbname=u890869027_bcom;charset=utf8', 'u890869027_bcom', '*******************');
|
$GLOBALS['bdd'] = new PDO('mysql:host=mysql.hostinger.fr;dbname=u890869027_bcom;charset=utf8', 'u890869027_bcom', '*******************');
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
die ('Erreur : ' . $e->getMessage());
|
die ('Erreur : ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO all exceptions in functions must be returns (make handle too)
|
|
||||||
//TODO in the classes , do more test of exists in setters
|
//TODO in the classes , do more test of exists in setters
|
||||||
include_once 'clazz/Utility.class.php';
|
include_once 'clazz/Utility.class.php';
|
||||||
include_once 'clazz/Langage.class.php';
|
include_once 'clazz/Langage.class.php';
|
||||||
@ -14,5 +14,6 @@ include_once 'clazz/Membre.class.php';
|
|||||||
include_once 'clazz/Discussion.class.php';
|
include_once 'clazz/Discussion.class.php';
|
||||||
include_once 'clazz/Message.class.php';
|
include_once 'clazz/Message.class.php';
|
||||||
include_once 'clazz/Projet.class.php';
|
include_once 'clazz/Projet.class.php';
|
||||||
|
include_once 'clazz/Article.class.php';
|
||||||
//TODO Use class's consts for file names
|
//TODO Use class's consts for file names
|
||||||
include_once 'clazz/Version.class.php';
|
include_once 'clazz/Version.class.php';
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
include_once 'includes/inter.php';
|
|
||||||
if(!isConnected()){
|
|
||||||
header('Location:403.php');
|
|
||||||
goto end;
|
|
||||||
}if(getAdminLevel()<2){ header('Location:401.php'); goto end;}$regex = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 éèàµ_\\-\'()\\[\\]\\\\/,;:.§!ù%£$¤=+\\-*\\#~"|ç@';$regex = '#^['.$regex.']+$#';
|
|
||||||
if(preg_match($regex,$_POST['name']) == 1){
|
|
||||||
createDiscut();
|
|
||||||
}else{ $_SESSION['current_error'] = 'Le nom de la discussion est incorrect : les caractères autorisés sont :<br/> abcdefghijklmnopqrstuvwxyz<wbr/>ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<wbr/> éèàμ_-\'()[\\]\\\\/<wbr/>,;:.§!ù%£$¤=+-*\\#~"|ç@';
|
|
||||||
echo $_POST['name']; header('Location:discuts.php');
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location:discuts.php');
|
|
||||||
end:
|
|
||||||
29
css/adminStyle.css
Normal file
29
css/adminStyle.css
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#adminDialogAnswer{
|
||||||
|
border-top: 2px solid black;
|
||||||
|
display: block;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
section.reponce{
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
section.reponce > h3{
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
section.reponce > samp{
|
||||||
|
background-color: #111;
|
||||||
|
color: #0F0;
|
||||||
|
}
|
||||||
|
section.commander{
|
||||||
|
border: 3px double black;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
div.commander{
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
section.commander > .commanderCommandSelector{
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
}
|
||||||
|
.facultatif{
|
||||||
|
border-bottom: 1px dotted silver;
|
||||||
|
}
|
||||||
@ -87,7 +87,7 @@ article{
|
|||||||
}
|
}
|
||||||
.articleText{
|
.articleText{
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin: 25px 125px;
|
margin: 5%;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@ -129,7 +129,7 @@ footer {
|
|||||||
|
|
||||||
#bande {
|
#bande {
|
||||||
display: block;
|
display: block;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 0px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
@ -268,11 +268,26 @@ section.message div {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disposition with width */
|
samp#universe_text{
|
||||||
.nav2x2 {
|
text-align: justify;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* HEADER STYLE */
|
||||||
|
.nav3x2 {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#navLinks a {
|
||||||
|
display: inline-block;
|
||||||
|
width: 250px;
|
||||||
|
font-size: 3ex;
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.navV {
|
.navV {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -295,21 +310,13 @@ section.message div {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1180px) { /* Afficher nav2x2 */
|
@media screen and (max-width: 1180px) { /* Afficher nav3x2 */
|
||||||
.nav2x2 {
|
.nav2x3 {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
#navLinks a {
|
|
||||||
display: inline-block;
|
|
||||||
width: 250px;
|
|
||||||
font-size: 3ex;
|
|
||||||
padding-left: 30px;
|
|
||||||
padding-right: 30px;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 615px) { /* Afficher navV */
|
@media screen and (max-width: 400px) { /* Afficher navV */
|
||||||
.navV {
|
.navV {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
@ -317,7 +324,5 @@ section.message div {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
font-size: 2ex;
|
font-size: 2ex;
|
||||||
padding-left: 30px;
|
|
||||||
padding-right: 30px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
include_once 'includes/inter.php';
|
|
||||||
|
|
||||||
if(!isConnected()){
|
|
||||||
header('Location:401.php');
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
$messageData = getMessage();
|
|
||||||
if($messageData == -1){
|
|
||||||
header('Location:404.php');
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(getAdminLevel()<6 && $_SESSION['session_id'] != $messageData['senderID']){
|
|
||||||
header('Location:403.php');
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
removeMessage();
|
|
||||||
header('Location:discut.php?d=' . $messageData['discussion_id']);
|
|
||||||
end:
|
|
||||||
143
discut.php
143
discut.php
@ -1,73 +1,90 @@
|
|||||||
<?php
|
<?php session_start ();
|
||||||
session_start ();
|
include_once 'clazz/Zincluder.php'; ?>
|
||||||
|
<!DOCTYPE html>
|
||||||
include_once 'includes/inter.php';
|
<html>
|
||||||
|
<head>
|
||||||
?><!DOCTYPE html><html><head>
|
|
||||||
<?php include 'includes/meta.php'; ?>
|
<?php include 'includes/meta.php'; ?>
|
||||||
</head><body> <script type="text/javascript" src="he.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" src="includes/he.js"></script>
|
||||||
<?php include 'includes/header.php'; ?>
|
<?php include 'includes/header.php'; ?>
|
||||||
<br />
|
|
||||||
<?php
|
<?php
|
||||||
|
//TODO re la fonction exiting
|
||||||
$disc = getDiscutInfos ();
|
$me = Membre::me();
|
||||||
|
if(!isset($_GET['d'])){
|
||||||
$adminLevel = - 1;
|
header ( 'Location:discuts.php');
|
||||||
|
$_SESSION ['current_error'] = 'Quand on demande des données, on donne des données !!!';
|
||||||
if (isConnected ())
|
exit;
|
||||||
|
}
|
||||||
$adminLevel = getAdminLevel ();
|
$discut = new Discussion($_GET['d']);
|
||||||
|
if(!$discut->exists()){
|
||||||
if (! ($disc ['autorized'] === 'p' or (preg_match ( "#^a[0-9]+$#", $disc ['autorized'] ) == 1) ? (intval ( substr ( $disc ['autorized'], 1 ) ) <= $adminLevel) : FALSE or preg_match ( '#^x([0-9];)*' . $_SESSION ['session_id'] . '(;[0-9])*$#', $disc ['autorized'] ) == 1 or $adminLevel >= 14)) {
|
header ( 'Location:discuts.php');
|
||||||
|
$_SESSION ['current_error'] = 'Je vais avoir du mal à afficher les donées de la version néant ...';
|
||||||
header ( 'Location:403.php' );
|
exit;
|
||||||
|
}
|
||||||
goto end;
|
if($me?!$discut->canAccess($me):!$discut->isPublic()){
|
||||||
} else if (! discutExists ()) {
|
header ( 'Location:discuts.php');
|
||||||
|
$_SESSION ['current_error'] = 'Vous n\'avez pas le droit d\'être ici ...<br/> DEGAGEZ !!!';
|
||||||
header ( 'Location:40A.php' );
|
exit;
|
||||||
|
}
|
||||||
goto end;
|
if ($me) {?>
|
||||||
}
|
<form id="postMessageForm" action="executor.php?action=postMessage&d=<?php echo $_GET['d'];?>" method="post">
|
||||||
|
<textarea row="5" placeholder="Votre message :" name="msg" autofocus="autofocus" required="required"></textarea>
|
||||||
else if (isConnected ()) {
|
<input type="submit" value="Poster le message">
|
||||||
|
</form>
|
||||||
?>
|
<!-- TODO : Entrée->envoyer le message (dégeulasse) -->
|
||||||
<form id="postMessageForm" action="posting_message.php?d=<?php echo $_GET['d'];?>" method="post"> <textarea row="5" placeholder="Votre message :" name="msg" autofocus="autofocus" required="required"></textarea> <input type="submit" value="Poster le message"> </form>
|
<script type="text/javascript">
|
||||||
<!-- Entrée->envoyer le message (dégeulasse) --> <script type="text/javascript"> $('#postMessageForm textarea').on('keypress',function(e){ if(e.which == 13){ $('#postMessageForm input').trigger('click'); e.stopPropagation(); } }); </script>
|
//Entrée -> envoi
|
||||||
|
$('#postMessageForm textarea').on('keypress',function(e){
|
||||||
|
if(e.which == 13){
|
||||||
|
$('#postMessageForm input').trigger('click');
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<?php }else{ ?>
|
<?php }else{ ?>
|
||||||
<div>Vous devez vous connecter pour envoyer des messages !</div>
|
<div>Vous devez vous connecter pour envoyer des messages !</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<main> </main> <script type="text/javascript"> var oldTimeout = setTimeout; window.setTimeout = function(callback, timeout) { console.log("timeout started"); return oldTimeout(function() { console.log('timeout finished'); callback(); }, timeout); }
|
<!-- Dans cette balise, le contenu de la discussion géré en javascript -->
|
||||||
function reloadEditListeners(){
|
<main></main>
|
||||||
$('.editLink').on('click',function(e){
|
|
||||||
editingLink = e.target;
|
<script type="text/javascript" defer>
|
||||||
e.target.innerHTML = 'Edition';
|
function reloadEditListeners(){
|
||||||
|
$('.editLink').on('click',function(e){
|
||||||
|
editingLink = e.target;
|
||||||
|
e.target.innerHTML = 'Edition';
|
||||||
|
|
||||||
$('#editMessageFullScreen').css('display','block');
|
$('#editMessageFullScreen').css('display','block');
|
||||||
$('#editMessageFullScreen div div form').attr('action','editing_message.php?d='+$(e.target).data('messageID'));
|
$('#editMessageFullScreen div div form').attr('action','editing_message.php?d='+$(e.target).data('messageID'));
|
||||||
$('#editMessageFullScreen').animate({opacity:0.97},1000);
|
$('#editMessageFullScreen').animate({opacity:0.97},1000);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
|
||||||
$('.delLink').on('click',function(e){
|
|
||||||
//console.log(e); e.target.innerHTML = 'Supression'; window.clearTimeout(currentClock);
|
|
||||||
$.post('deletingMessage.php?m='+$(e.target).data('messageID'),{},askData);
|
|
||||||
e.stopPropagation();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#abortEdition').on('click',function(e){
|
|
||||||
editingLink.innerHTML = 'Editer';
|
|
||||||
$('#editMessageFullScreen div div form').attr('action','js_waiting');
|
|
||||||
$('#editMessageFullScreen').animate({opacity:0.00},1000,function(e){
|
|
||||||
$('#editMessageFullScreen').css('display','none');
|
|
||||||
});
|
});
|
||||||
});
|
$('.delLink').on('click',function(e){
|
||||||
}
|
e.target.innerHTML = 'Supression';
|
||||||
</script> <!-- Messages download --> <script type="text/javascript"> var currentClock = null;
|
window.clearTimeout(currentClock);
|
||||||
|
$.post('executor.php?action=deleteMessage&m='+$(e.target).data('messageID'),{},askData);
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#abortEdition').on('click',function(e){
|
||||||
|
editingLink.innerHTML = 'Editer';
|
||||||
|
$('#editMessageFullScreen div div form').attr('action','js_waiting');
|
||||||
|
$('#editMessageFullScreen').animate({opacity:0.00},1000,function(e){
|
||||||
|
$('#editMessageFullScreen').css('display','none');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Messages download -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
var currentClock = null;
|
||||||
|
|
||||||
var askData = function(){
|
var askData = function(){
|
||||||
$.post('getDiscutsMessages.php?d=<?php echo testInt($_GET['d'],'40A.php');?>',{},dataGet);
|
console.log('dataasked<?php echo $discut->getID();?>');
|
||||||
|
$.post('executor.php?action=getDiscutsMessages&d=<?php echo $discut->getID();?>',{},dataGet);
|
||||||
}
|
}
|
||||||
var dataGet = function(data,status){
|
var dataGet = function(data,status){
|
||||||
var newData = eval(data);
|
var newData = eval(data);
|
||||||
@ -115,7 +132,9 @@ include_once 'includes/inter.php';
|
|||||||
}
|
}
|
||||||
$(document).ready(askData);
|
$(document).ready(askData);
|
||||||
</script>
|
</script>
|
||||||
<div id="editMessageFullScreen" class="fullscreen absent">
|
|
||||||
|
<!-- Edit message div -->
|
||||||
|
<div id="editMessageFullScreen" class="fullscreen absent">
|
||||||
<div class="screen-vertical-centered">
|
<div class="screen-vertical-centered">
|
||||||
<div class="screen-horizontal-centered">
|
<div class="screen-horizontal-centered">
|
||||||
<form id="editMessageForm" action="js modified" method="post">
|
<form id="editMessageForm" action="js modified" method="post">
|
||||||
@ -127,4 +146,6 @@ include_once 'includes/inter.php';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
</body></html><?php end: ?>
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
78
discuts.php
78
discuts.php
@ -1,44 +1,48 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start ();
|
session_start ();
|
||||||
|
include_once 'clazz/Zincluder.php';?>
|
||||||
include_once 'includes/inter.php';
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
?><!DOCTYPE html><html><head>
|
<head>
|
||||||
<?php include 'includes/meta.php'; ?>
|
<?php include 'includes/meta.php'; ?>
|
||||||
</head><body>
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
<?php include 'includes/header.php'; ?>
|
<?php include 'includes/header.php'; ?>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$me = Membre::me();
|
||||||
|
$discs = $me?Discussion::getWhichHeCanAccess($me):Discussion::getPublics();
|
||||||
|
foreach ($discs as $disc) {
|
||||||
|
echo '<a href="discut.php?d=' . $disc->getID() . '">' . $disc->getName() . ' par ' . $disc->getCreator()->getPseudo() . '</a><br/>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php if($me?$me->isAdminLevelGreaterThan(8):FALSE){?>
|
||||||
|
<span id="createNewDiscBefore">Creer une nouvelle discussion</span>
|
||||||
|
|
||||||
|
<form id="createNewDiscForm" action="executor.php?action=createDiscussion" method="post">
|
||||||
|
<label for="newDiscText"></label><input id="newDiscText" type="text" name="name" />
|
||||||
|
<input type="submit" value="Créer la discussion" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
//Creer nouvelle discussion click event //TODO upgrade to jquery
|
||||||
|
var span = document.getElementById('createNewDiscBefore');
|
||||||
|
span.addEventListener('click',function(){
|
||||||
|
document.getElementById('createNewDiscBefore').style.display = 'none';
|
||||||
|
document.getElementById('createNewDiscForm').style.display = 'block';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$discs = getDiscuts ();
|
|
||||||
|
|
||||||
$adminLevel = - 1;
|
|
||||||
|
|
||||||
if (isConnected ())
|
|
||||||
$adminLevel = getAdminLevel ();
|
|
||||||
|
|
||||||
foreach ( $discs as $disc ) {
|
|
||||||
if ($disc ['autorized'] === 'p' or
|
|
||||||
(preg_match ( "#^a[0-9]+$#", $disc ['autorized'] ) == 1) ? (intval ( substr ( $disc ['autorized'], 1 ) ) <= $adminLevel) : FALSE or
|
|
||||||
preg_match ( '#^x([0-9];)*' . $_SESSION ['session_id'] . '(;[0-9])*$#', $disc ['autorized'] ) == 1 or
|
|
||||||
$adminLevel >= 14) {
|
|
||||||
|
|
||||||
echo '<a href="discut.php?d=' . $disc ['ID'] . '">' . $disc ['name'] . ' par ' . getPseudoOf ( $disc ['creator_id'] ) . '</a><br/>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<?php if(isConnected() && getAdminLevel()>=2){?>
|
<?php }?>
|
||||||
<span id="createNewDiscBefore">Creer une nouvelle discussion</span> <form id="createNewDiscForm" action="creating_discussion.php" method="post"> <label for="newDiscText"></label> <input id="newDiscText" type="text" name="name" /> <input type="submit" value="Créer la discussion" /> </form> <script type="text/javascript">
|
|
||||||
var span = document.getElementById('createNewDiscBefore');
|
|
||||||
span.addEventListener('click',function(){
|
|
||||||
document.getElementById('createNewDiscBefore').style.display = 'none';
|
|
||||||
document.getElementById('createNewDiscForm').style.display = 'block';
|
|
||||||
});
|
|
||||||
</script> <br /> <br />
|
|
||||||
<?php }?>
|
|
||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
</body></html>
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@ -9,16 +9,6 @@ include_once 'includes/inter.php';
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php include 'includes/header.php'; ?>
|
<?php include 'includes/header.php'; ?>
|
||||||
<?php include_once 'includes/inter.php';
|
|
||||||
$data = getProjectVersionData();
|
|
||||||
if(!isConnected()){
|
|
||||||
header("Location:401.php");
|
|
||||||
goto end;
|
|
||||||
}else if(!preg_match('#[^0-9]?' . $_SESSION['session_id'] .'[^0-9]?#',$data ['owners'])){
|
|
||||||
header("Location:403.php");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -42,5 +32,3 @@ include_once 'includes/inter.php';
|
|||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php end:
|
|
||||||
?>
|
|
||||||
207
executor.php
207
executor.php
@ -1,43 +1,182 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start ();
|
session_start ();
|
||||||
include_once 'clazz/Membre.class.php';
|
include_once 'clazz/Zincluder.php';
|
||||||
$me = new Membre ();
|
$me = Membre::me();
|
||||||
|
/*
|
||||||
|
TODO add $_GET['p'] => should return on $_SESSION ['current_error'] (0) or via echo (1)
|
||||||
|
*/
|
||||||
|
|
||||||
if (! isset ( $_GET ['action'] )) {
|
function exiting($message,$location='register.php'){
|
||||||
header ( 'Location:40A.php' );
|
header ( 'Location:' . $location );
|
||||||
exit();
|
$_SESSION ['current_error'] = $message;
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (! isset ( $_GET ['action'] ))
|
||||||
|
exiting(NULL,'40A.php');
|
||||||
|
|
||||||
|
|
||||||
switch ($_GET ['action']) {
|
switch ($_GET ['action']) {
|
||||||
case 'register' :
|
case 'register' :
|
||||||
if (isset ( $_POST ['pseudo'] ) && isset ( $_POST ['mdp'] ) && isset ( $_POST ['mdp2'] )) {
|
//Action : register
|
||||||
if ($_POST ['mdp'] === $_POST ['mdp2']) {
|
if (!(isset ( $_POST ['pseudo'] ) && isset ( $_POST ['mdp'] ) && isset ( $_POST ['mdp2'] )))
|
||||||
if (preg_match ( "#^[a-zA-Z0-9\\-_]+$#", $_POST ['pseudo'] )) {
|
exiting('Quand on demande des données, on donne des données !!!');
|
||||||
if (preg_match ( "#^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\-_&éèàùçµ\"\\#'{}()[\\]|\\^@°+=\$¤£*!§:/;.,?²]+$#", $_POST ['mdp'] )) {
|
if ($_POST ['mdp'] === $_POST ['mdp2'])
|
||||||
|
exiting('Tu auras du rentrer deux fois le même mot de passe (tu permet aussi de rendre le champs "Recopier le mot de passe" utile)');
|
||||||
switch (Membre::registerPerson ()) {
|
if (preg_match ( "#^[a-zA-Z0-9\\-_]+$#", $_POST ['pseudo'] ))
|
||||||
case 'ok' :
|
exiting('Le pseudo sera incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_');
|
||||||
$_SESSION ['current_error'] = 'Vous avez déjà été correctement inscrit sur bernard.com';
|
if (preg_match ( "#^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\-_&éèàùçµ\"\\#'{}()[\\]|\\^@°+=\$¤£*!§:/;.,?²]+$#", $_POST ['mdp'] ))
|
||||||
header('Location:login.php');
|
exiting('Le mot de passe fut incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_&éèàùçμ"#\'{}()[]|^@°+=$¤£*!§:/;.,?²');
|
||||||
exit();
|
|
||||||
case 'usedPseudo' :
|
$out = Membre::registerPerson ($_POST ['pseudo'],$_POST ['mdp']);
|
||||||
$_SESSION ['current_error'] = 'Le pseudonyme est déjà utilisé (par une entité differente de vous)';
|
if($out ===Membre::USED_USERNAME)
|
||||||
break;
|
exiting('Le pseudonyme est déjà utilisé (par une entité differente de vous)');
|
||||||
}
|
exiting('Vous avez déjà été correctement inscrit sur bernard.com','login.php');
|
||||||
} else {
|
|
||||||
$_SESSION ['current_error'] = 'Le mot de passe fut incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_&éèàùçµ"#\'{}()[]|^@°+=$¤£*!§:/;.,?²';
|
case 'login' :
|
||||||
}
|
//Action : login
|
||||||
} else {
|
if (!( isset ( $_POST ['pseudo'] ) && isset ( $_POST ['mdp'] ) ))
|
||||||
|
exiting('Quand on demande des données, on donne des données !!!');
|
||||||
$_SESSION ['current_error'] = 'Le pseudo sera incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
|
$me = Membre::getFromPseudo($_POST['pseudo']);
|
||||||
}
|
if(!$me)
|
||||||
} else {
|
exiting('Kikètvou ? Pseudo inconnu ...');
|
||||||
|
if(!$me->connect($_POST ['mdp']))
|
||||||
$_SESSION ['current_error'] = 'Tu auras du rentrer deux fois le même mot de passe (tu permet aussi de rendre le champs "Recopier le mot de passe" utile)';
|
exiting('Votre empreinte rétinale, digital et génetique ne correspond pas à celles stoquées dans notre base de données (Technologie à venir)');
|
||||||
}
|
$_SESSION['session_id'] = $me->getID();
|
||||||
} else {
|
$_SESSION['session_mdp'] = $_POST['mdp'];
|
||||||
|
exiting('Vous êtes bien connecté (vous l\'avez été et le serez également)!');
|
||||||
$_SESSION ['current_error'] = 'Quand on demande des données , on donne des données !!!';
|
|
||||||
|
case 'changePassword' :
|
||||||
|
//Action : change password
|
||||||
|
if(!(isset($_POST['rmdp']) && isset($_POST['nmdp']) && isset($_POST['nmdp2'])))
|
||||||
|
exiting('Quand on demande des données, on donne des données !!!');
|
||||||
|
if(!$me)
|
||||||
|
exiting('Si tu ne te connectes pas, comment veut tu que je sache quel mot de passe changer !');
|
||||||
|
if(!$me->connect($_POST['rmdp']))
|
||||||
|
exiting('Votre empreinte rétinale, digital et génetique ne correspond pas à celles stoquées dans notre base de données (Technologie à venir)');
|
||||||
|
if($_POST['nmdp'] !== $_POST['nmdp2'])
|
||||||
|
exiting('Tu auras du rentrer deux fois le même mot de passe (tu permet aussi de rendre le champs "Recopier le mot de passe" utile)');
|
||||||
|
$out = $me->changePassword($_POST['nmdp']);
|
||||||
|
if($out == Membre::PASSWORD_TOO_LONG)
|
||||||
|
exiting('Mot de passe ≠ roman (255 caractères maximum)');
|
||||||
|
exiting('Vos dispositifs d\'identification ont été correctement changés');
|
||||||
|
|
||||||
|
case 'createDiscussion' :
|
||||||
|
//Action : create discussion
|
||||||
|
if(!isset($_POST['name']))
|
||||||
|
exiting('Quand on demande des données, on donne des données !!!');
|
||||||
|
if(!$me)
|
||||||
|
exiting('Veuillez vous identifier pour acceder à cette section !!!');
|
||||||
|
if(!$me->connect($_SESSION['session_mdp']))
|
||||||
|
exiting('Votre empreinte rétinale, digital et génetique ne correspond pas à celles stoquées dans notre base de données (Technologie à venir)');
|
||||||
|
if($me->isAdminLevelLowerThan(2))
|
||||||
|
exiting('Vous n\'êtes pas assez PUISSANT !!!!!!!!!! (Faut un adminLevel de 2 ou plus)');
|
||||||
|
|
||||||
|
$out = Discussion::createDiscussion($_POST ['name'],$_SESSION ['session_id']);
|
||||||
|
if($out === Discussion::NAME_ALREADY_USED)
|
||||||
|
exiting('Mince j\'ai déjà utilisé l\'écriteau avec ce nom ... t\'en as pas un autre ?');
|
||||||
|
if($out === Discussion::ILLEGAL_NAME)
|
||||||
|
exiting('Y a des trucs qui ne me plaisent pas dans le nom que tu as donné à ta discussion ...<br/>Je n\'accepte que les caractères abcdefghijklmnopqrstuvwxyz<wbr/>ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<wbr/>éèàμ_-\'()[\\]\\\\/<wbr/>,;:.§!ù%£$¤=+-*\\#~"|ç@');
|
||||||
|
if($out === Discussion::TOO_LONG_NAME)
|
||||||
|
exiting('Nom de discussion ≠ roman (255 caractères maximum)');
|
||||||
|
exiting('C\'est fait !!! (la création de ta discussion bien sûr)');
|
||||||
|
|
||||||
|
case 'postMessage' :
|
||||||
|
//Action : post message
|
||||||
|
if(!$me)
|
||||||
|
exiting('Veuillez vous identifier pour acceder à cette section !!!');
|
||||||
|
if(!$me->connect($_SESSION['session_mdp']))
|
||||||
|
exiting($me.'Votre empreinte rétinale, digital et génetique ne correspond pas à celles stoquées dans notre base de données (Technologie à venir)');
|
||||||
|
$discussion = new Discussion($_GET ['d']);
|
||||||
|
if(!$discussion->exists())
|
||||||
|
exiting('Pour des raisons d\'intégrité du site, nous avons décidé de ne pas autoriser les messages dans les discussions inexistantes (pour les superadmins, c\'est possible en forcant la bdd &128516; )');
|
||||||
|
if(!$discussion->canAccess($me))
|
||||||
|
exiting('Tu pensais que tu pouvais écrire des messages dans une discussion à laquelle tu n\'as pas accès !!! Tu te crois où ?');
|
||||||
|
Message::sendMessage($me,$discussion,$_POST ['msg']);
|
||||||
|
exiting(NULL,'discut.php?d='.$discussion->getID());
|
||||||
|
case 'deleteMessage' :
|
||||||
|
//Action : delete message
|
||||||
|
if(!isset($_GET ['m']))
|
||||||
|
exiting('c');
|
||||||
|
if(!$me)
|
||||||
|
exiting('Veuillez vous identifier pour supprimer un message !!!');
|
||||||
|
if(!$me->connect($_SESSION['session_mdp']))
|
||||||
|
exiting('Votre empreinte rétinale, digital et génetique ne correspond pas à celles stoquées dans notre base de données (Technologie à venir)');
|
||||||
|
$message = new Message($_GET['m']);
|
||||||
|
if(!$message->exists())
|
||||||
|
exiting('Je vais avoir du mal à supprimer le message n&ecute;ant ...');
|
||||||
|
if($me->isAdminLevelLowerThan(6) && $me->getID() !== $message->getSender()->getID())
|
||||||
|
exiting('Vous n\'êtes pas assez PUISSANT !!!!!!!!!! (Faut un adminLevel de 6 ou plus OU etre l\'auteur de ce message');
|
||||||
|
$message->removeMessage();
|
||||||
|
exiting(NULL,'discut.php?d='.$message->getDiscussion()->getID());
|
||||||
|
case 'editVersion' :
|
||||||
|
//Action : edit version
|
||||||
|
if(!isset($_GET ['v']))
|
||||||
|
exiting('Quand on demande des données, on donne des données !!!');
|
||||||
|
if(!$me)
|
||||||
|
exiting('Veuillez vous identifier pour éditer une version !!!');
|
||||||
|
if(!$me->connect($_SESSION['session_mdp']))
|
||||||
|
exiting('Votre empreinte rétinale, digital et génetique ne correspond pas à celles stoquées dans notre base de données (Technologie à venir)');
|
||||||
|
$version = new Version($_GET['v']);
|
||||||
|
if(!$version->exists())
|
||||||
|
exiting('Je vais avoir du mal à éditer la version n&ecute;ant ...');
|
||||||
|
if($me->isAdminLevelLowerThan(13) && $version->getProject()->haveRights($me))
|
||||||
|
exiting('Vous n\'êtes pas assez PUISSANT !!!!!!!!!! (Faut un adminLevel de 6 ou plus OU etre un des pocesseurs du projet');
|
||||||
|
//TODO concretly modify the version, with all the options (remove included)
|
||||||
|
exit;
|
||||||
|
case 'getDiscutsMessages' :
|
||||||
|
//Action : get discut's messages
|
||||||
|
//TODO precise output type (via $_GET)
|
||||||
|
$query = 'SELECT m.ID AS messageID,u.ID AS senderID, u.pseudo AS pseudo, m.texte AS texte, m.sendTime AS sendTime, UNIX_TIMESTAMP(m.sendTime) AS sendTimestamp FROM users AS u INNER JOIN messages AS m ON u.ID = m.senderID WHERE m.discussion_id=?';
|
||||||
|
|
||||||
|
$data = array ();
|
||||||
|
if(!isset($_GET ['d'])){
|
||||||
|
echo 'ERROR : NO DISCUSSION PROVIDED';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if($me?!$me->connect($_SESSION['session_mdp']):FALSE){
|
||||||
|
echo 'Votre empreinte rétinale, digital et génetique ne correspond pas à celles stoquées dans notre base de données (Technologie à venir)';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$discut = new Discussion($_GET ['d']);
|
||||||
|
if(!$discut->exists()){
|
||||||
|
echo 'Quand on demande des données, on donne des données !!!';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$messages = Utility::arrayIfNot(Message::getFromDiscussion($discut));
|
||||||
|
$jmsgs = array();
|
||||||
|
foreach($messages as $message){
|
||||||
|
$jmsg = array();
|
||||||
|
$jmsg['messageID'] = $message->getID();
|
||||||
|
$jmsg['senderID'] = $message->getSender()->getID();
|
||||||
|
$jmsg['pseudo'] = $message->getSender()->getPseudo();
|
||||||
|
$jmsg['texte'] = $message->getText();
|
||||||
|
$jmsg['sendTime'] = $message->getSendDate();
|
||||||
|
$jmsg['sendTimestamp'] = strToTime($message->getSendDate());
|
||||||
|
$jmsg['rights'] = ($me)? $message->getSender()->getID() == $me->getID() || $me->isAdminLevelGreaterThan(5):FALSE;
|
||||||
|
array_push($jmsgs,$jmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
header ( 'Location:register.php' );
|
echo json_encode ( $jmsgs );
|
||||||
|
flush ();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
19
extras/quizz.yml
Normal file
19
extras/quizz.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
!!com.bernard.qcminator.quiz.DEVerbenQuiz
|
||||||
|
author: Mysaa
|
||||||
|
entryCount: 2
|
||||||
|
name: Schwach verben
|
||||||
|
verben:
|
||||||
|
- aux: 0
|
||||||
|
infinitiv: [gehen, gaiheun, gaien, geheun]
|
||||||
|
partizipPerfekt: [gegangen, gegehen, gegeht, gegehet]
|
||||||
|
prasens2: [gehst, gaist]
|
||||||
|
prasens3: [geht, gaitte, gait, gétteu, gäht]
|
||||||
|
prateritum2: [ginget, gingueut]
|
||||||
|
prateritum3: [ging, gung, gang, gèng]
|
||||||
|
- aux: 1
|
||||||
|
infinitiv: [schwimmen, chvimeun, schwimen, schvimmen]
|
||||||
|
partizipPerfekt: [geschwommen, geschwomen, schwomen, schwommen]
|
||||||
|
prasens2: [schwimmst, schwimst]
|
||||||
|
prasens3: [schwimmt, schwimt]
|
||||||
|
prateritum2: [schwammst, schwamst]
|
||||||
|
prateritum3: [schwamm, schwamt, schwam, schwammte]
|
||||||
9
form.php
9
form.php
@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<form action="admindialog.php" method="post"><input name="command" type="text"/><input type="submit"/></form>
|
|
||||||
<div id="div1"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
include_once 'includes/inter.php';
|
|
||||||
$query = 'SELECT m.ID AS messageID,u.ID AS senderID, u.pseudo AS pseudo, m.texte AS texte, m.sendTime AS sendTime, UNIX_TIMESTAMP(m.sendTime) AS sendTimestamp FROM users AS u INNER JOIN messages AS m ON u.ID = m.senderID WHERE m.discussion_id=?';
|
|
||||||
|
|
||||||
$data = array ();
|
|
||||||
$pseudoID = -1;
|
|
||||||
$adminLevel = -1;
|
|
||||||
if(isConnected()){
|
|
||||||
$pseudoID = $_SESSION['session_id'];
|
|
||||||
$adminLevel = getAdminLevel();
|
|
||||||
}
|
|
||||||
|
|
||||||
$req = $GLOBALS ['bdd']->prepare ( $query );
|
|
||||||
$req->execute ( array (
|
|
||||||
$_GET ['d']
|
|
||||||
) );
|
|
||||||
while ( $donnees = $req->fetch () ) {
|
|
||||||
$donnees['rights'] = $donnees['senderID'] == $pseudoID || $adminLevel>=6;
|
|
||||||
array_push ( $data, $donnees );
|
|
||||||
$bool = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$req->closeCursor ();
|
|
||||||
echo json_encode ( $data );
|
|
||||||
|
|
||||||
flush ();
|
|
||||||
1
includes/MathJax
Submodule
1
includes/MathJax
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit be11806df1ae075508e33500c990497062ef3c5a
|
||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
try{
|
try{
|
||||||
//$bdd = new PDO('mysql:host=localhost;dbname=bernard.com;charset=utf8', 'root', '');
|
$GLOBALS['bdd'] = new PDO('mysql:host=127.0.0.1;dbname=u890869027_bcom;charset=utf8', 'u890869027', '*******************');
|
||||||
$GLOBALS['bdd'] = new PDO('mysql:host=mysql.hostinger.fr;dbname=u890869027_bcom;charset=utf8', 'u890869027_bcom', '*******************');
|
//$GLOBALS['bdd'] = new PDO('mysql:host=mysql.hostinger.fr;dbname=u890869027_bcom;charset=utf8', 'u890869027_bcom', '*******************');
|
||||||
}catch(Exception $e){
|
}catch(Exception $e){
|
||||||
die ('Erreur : ' . $e->getMessage());
|
die ('Erreur : ' . $e->getMessage() . "\n");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -10,14 +10,19 @@
|
|||||||
|
|
||||||
<a href="" id="haut_de_page">Haut de page</a>
|
<a href="" id="haut_de_page">Haut de page</a>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($_SESSION['current_error'])){
|
if(isset($_SESSION['current_error'])){
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="fullscreen opaque">
|
<div class="fullscreen opaque">
|
||||||
<div class="screen-vertical-centered">
|
<div class="screen-vertical-centered">
|
||||||
<div class="screen-horizontal-centered"><?php echo $_SESSION['current_error'];?></div>
|
<div class="screen-horizontal-centered">
|
||||||
|
<?php echo $_SESSION['current_error'];?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('.fullscreen').on('click',function(){
|
$('.fullscreen').on('click',function(){
|
||||||
|
|||||||
@ -1,54 +1,56 @@
|
|||||||
|
<?php include_once 'clazz/Zincluder.php'; ?>
|
||||||
<header>
|
<header>
|
||||||
<!--
|
|
||||||
000000000000000800000000000000000000000000000000000000000000000000000
|
<!--
|
||||||
000000000000008000000000000000000000000000000000000000000000000000000
|
000000000000000800000000000000000000000000000000000000000000000000000
|
||||||
000000000000080000000000000888000000000000000000000000000000000000000
|
000000000000008000000000000000000000000000000000000000000000000000000
|
||||||
000000000000800000000000088000880000000000000000000000000000000000000
|
000000000000080000000000000888000000000000000000000000000000000000000
|
||||||
000000000008008000000000000000080000000000000000000000000000000000000
|
000000000000800000000000088000880000000000000000000000000000000000000
|
||||||
000000000080008000000000000000800000000000000000000000000000000000000
|
000000000008008000000000000000080000000000000000000000000000000000000
|
||||||
000000000888888888000000000008000000000000000000000000000000000000000
|
000000000080008000000000000000800000000000000000000000000000000000000
|
||||||
000000000000008000000000000080000000000000000000000000000000000000000
|
000000000888888888000000000008000000000000000000000000000000000000000
|
||||||
000000000000008000000000000800000000000000000000000000000000000000000
|
000000000000008000000000000080000000000000000000000000000000000000000
|
||||||
000000000000008000000000088888880000000000000000000000000000000000000
|
000000000000008000000000000800000000000000000000000000000000000000000
|
||||||
000000000000000000000000000000000000000000000000000000000000000000000
|
000000000000008000000000088888880000000000000000000000000000000000000
|
||||||
000000000000000000000000000000000000000000000000000000000000000000000
|
000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
000000000000000000000000000000000000000000000000000000000000000000000
|
000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
-->
|
000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
-->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once('includes/inter.php');
|
if($me = Membre::me()){
|
||||||
if(isConnected()){
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="bienvenue">Bienvenue à toi, <?php echo getPseudo(); ?>
|
<div id="bienvenue">Bienvenue à toi, <?php echo $me->getPseudo(); ?>
|
||||||
<form id="headDisconnectForm" method="post" action="disconnect.php">
|
<form id="headDisconnectForm" method="post" action="disconnect.php">
|
||||||
<input type="submit" value="Se déconnecter" />
|
<input type="submit" value="Se déconnecter" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php }else{ ?>
|
<?php }else{ ?>
|
||||||
|
|
||||||
<form id="headLoginForm" method="post" action="logging.php">
|
<form id="headLoginForm" method="post" action="executor.php?action=login">
|
||||||
<label for="pseudo">Pseudo :</label>
|
<label for="pseudo">Pseudo :</label>
|
||||||
<input type="text" name="pseudo" id="pseudo" placeholder="Ex:Bernard" />
|
<input type="text" name="pseudo" id="pseudo" placeholder="Ex:Bernard" />
|
||||||
<label for="mdp">Mot de passe :</label>
|
<label for="mdp">Mot de passe :</label>
|
||||||
<input type="password" name="mdp" id="mdp" placeholder="Votre mot de passe" />
|
<input type="password" name="mdp" id="mdp" placeholder="Votre mot de passe" />
|
||||||
<input type="submit" value="Se connecter" />
|
<input type="submit" value="Se connecter" />
|
||||||
</form>
|
</form>
|
||||||
<form id="headLittleLoginForm" method="post" action="login.php">
|
<form id="headLittleLoginForm" method="post" action="login.php">
|
||||||
<input type="submit" value="Se connecter" />
|
<input type="submit" value="Se connecter" />
|
||||||
</form>
|
</form>
|
||||||
<form id="headRegisterForm" method="post" action="register.php">
|
<form id="headRegisterForm" method="post" action="register.php">
|
||||||
<input type="submit" value="S'inscrire" />
|
<input type="submit" value="S'inscrire" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<img id="bande" src="pictures/<?php if(rand()*31415 < 110*42)echo "lucas_president.png";else echo "bande.png";?>" alt="Erreur d'affichage de l'image" width=1000 height="89" />
|
<img id="bande" src="pictures/<?php if(rand(0,314159) < 110*42)echo "lucas_president.png";else echo "bande.png";?>" alt="Erreur d'affichage de l'image" width=1000 height="89" />
|
||||||
<nav id="navLinks">
|
<nav id="navLinks">
|
||||||
<a href="index.php">Accueil</a><br class="navV"/>
|
<a href="index.php">Accueil</a><br class="navV"/>
|
||||||
<a href="projets.php">Mes Projets</a><br class="nav2x2"/>
|
<a href="projets.php">Mes Projets</a><br class="nav3x2 navV"/>
|
||||||
<a href="others.php">Tous les projets</a><br class="navV"/>
|
<a href="others.php">Tous les projets</a><br class="navV"/>
|
||||||
<a href="discuts.php">Discussions</a><br class="navV"/>
|
<a href="discuts.php">Discussions</a><br class="navV"/>
|
||||||
<a href="profile.php">Mon profil</a><br class="navV"/>
|
<a href="profile.php">Mon profil</a><br class="navV"/>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@ -2,8 +2,12 @@
|
|||||||
include_once 'includes/bdd.php';
|
include_once 'includes/bdd.php';
|
||||||
function isConnected($sid = NULL, $mdp = NULL) {
|
function isConnected($sid = NULL, $mdp = NULL) {
|
||||||
if (! isset ( $sid ) or ! isset ( $mdp )) {
|
if (! isset ( $sid ) or ! isset ( $mdp )) {
|
||||||
$sid = $_SESSION ['session_id'];
|
if(isset($_SESSION ['session_id']) and isset($_SESSION ['session_mdp'])){
|
||||||
$mdp = $_SESSION ['session_mdp'];
|
$sid = $_SESSION ['session_id'];
|
||||||
|
$mdp = $_SESSION ['session_mdp'];
|
||||||
|
}else{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE ID=?' );
|
$req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE ID=?' );
|
||||||
$req->execute ( array (
|
$req->execute ( array (
|
||||||
|
|||||||
@ -3,9 +3,16 @@
|
|||||||
<meta name="keywords" lang="fr" content="cercloid officiel, zeidhyx project" />
|
<meta name="keywords" lang="fr" content="cercloid officiel, zeidhyx project" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="stylesheet" href="css/style.css" />
|
<link rel="stylesheet" href="css/style.css" />
|
||||||
<script type="text/x-mathjax-config"> MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}}); </script>
|
|
||||||
<script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML"> </script>
|
<script type="text/x-mathjax-config"> MathJax.Hub.Config({
|
||||||
|
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
|
||||||
|
CommonHTML: { linebreaks: { automatic: true }, scale: ((window.innerWidth || document.body.clientWidth)<600)?70:100},
|
||||||
|
"HTML-CSS": { linebreaks: { automatic: true } },
|
||||||
|
SVG: { linebreaks: { automatic: true } }});
|
||||||
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var headBloc = document.getElementsByTagName("head")[0];
|
||||||
|
//Load css according to the browser
|
||||||
var link = document.createElement( "link" );
|
var link = document.createElement( "link" );
|
||||||
link.type = "text/css";
|
link.type = "text/css";
|
||||||
link.rel = "stylesheet";
|
link.rel = "stylesheet";
|
||||||
@ -15,5 +22,22 @@
|
|||||||
}else{
|
}else{
|
||||||
link.href = "css/noFirefoxStyle.css";
|
link.href = "css/noFirefoxStyle.css";
|
||||||
}
|
}
|
||||||
document.getElementsByTagName("head")[0].appendChild( link );
|
headBloc.appendChild( link );
|
||||||
</script>
|
|
||||||
|
//Load server jQuery if not loaded
|
||||||
|
var jQuerySrc = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML'
|
||||||
|
var mathJaxSrc = 'http://code.jquery.com/jquery-latest.min.js'
|
||||||
|
if(!navigator.onLine){
|
||||||
|
jQuerySrc = 'includes/jquery-latest.min.js';
|
||||||
|
mathJaxSrc = "includes/MathJax/MathJax.js?config=TeX-AMS_CHTML";
|
||||||
|
}
|
||||||
|
var script = document.createElement("script");
|
||||||
|
script.type = "text/javascript";
|
||||||
|
script.src = jQuerySrc;
|
||||||
|
headBloc.appendChild(script);
|
||||||
|
script = document.createElement("script");
|
||||||
|
script.type = "text/javascript";
|
||||||
|
script.src = mathJaxSrc;
|
||||||
|
headBloc.appendChild(script);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
129
index.php
129
index.php
@ -11,128 +11,17 @@
|
|||||||
|
|
||||||
<p><font size=4>J'ai le plaisir de vous souhaiter la bienvenue au sein de notre site: bernard.890m.com</font></p>
|
<p><font size=4>J'ai le plaisir de vous souhaiter la bienvenue au sein de notre site: bernard.890m.com</font></p>
|
||||||
|
|
||||||
<article id="cercloidOfficiel">
|
<?php foreach(Article::getNewest(10) as $article){ ?>
|
||||||
<h2 class="articleTitle"><strong>Cercloïde</strong></h2>
|
<article>
|
||||||
<a class="articlePic" href="pictures/cercloid_cacahuete.png"><img src="pictures/cercloid_cacahuete.png" width="128" /></a>
|
<!-- TODO put class on article node -->
|
||||||
|
<h2 class="articleTitle"><?php echo $article->getTitle(); ?></h2>
|
||||||
<div class="articleText">
|
<?php if($article->getPicPath() != ''){?><a class="articlePic" href="<?php echo $article->getPicPath(); ?>"><img src="<?php echo $article->getPicPath(); ?>" width="128" /></a><?php }?>
|
||||||
$$C: \sum_{n=1}^N{\sqrt[p]{\sum_{g=1}^G{\left|F_{g,n}-A_n\right|^p}}}=r$$
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>\(p \in \mathbb{R}^*\) : l'exposant qui détermine la norme utilisé</li>
|
|
||||||
<li>\(N \in \mathbb{N}^*\) : le nombre de dimension de l'espace</li>
|
|
||||||
<li>\(G \in \mathbb{N}^*\) : le nombre de foyer</li>
|
|
||||||
<li>\(r \in \mathbb{R}_+\) : le rayon</li>
|
|
||||||
<li>\(A \in \mathbb{R}^N\) : le point considéré</li>
|
|
||||||
<li>\(F \in (\mathbb{R}^N)^G\) : le tableau de foyer</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article id="zeidhyxProject">
|
<div class="articleText"><?php echo ($article->getShort() == '')?$article->getText():$article->getShort(); ?></div>
|
||||||
<h2 class="articleTitle"><strong>Zeidhyx Project</strong></h2>
|
</article>
|
||||||
<a class="articlePic" href="pictures/into_donut.png"><img src="pictures/into_donut.png" width="128" /></a>
|
<?php } ?>
|
||||||
|
|
||||||
<div class="articleText">
|
|
||||||
<p>
|
|
||||||
Eclipse Neon download: <a href="http://ftp-stud.fht-esslingen.de/Mirrors/eclipse/oomph/epp/neon/R/eclipse-inst-win64.exe"> Win64</a>|<a href="http://ftp-stud.fht-esslingen.de/Mirrors/eclipse/oomph/epp/neon/R/eclipse-inst-win32.exe">32</a>.<br/>
|
|
||||||
Téléchargement du workspace Eclipse ici :
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>2016/09/21 19h : <a href="tempPreMega/zeidhyx1.zip">download</a></li>
|
|
||||||
<li>2016/10/15 23h : <a href="tempPreMega/zeidhyx2.zip">download</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article id="bezierCurve">
|
|
||||||
<h2 class="articleTitle"><strong>Courbe de Bézier</strong></h2>
|
|
||||||
<a class="articlePic" href="pictures/gebra_bezier_a_12.png"><img src="pictures/gebra_bezier_a_12.png" width="128" /></a>
|
|
||||||
|
|
||||||
<div class="articleText">
|
|
||||||
<ul>
|
|
||||||
<li>\(N \in \mathbb{N}^*\) : nombre de point nécessaire pour décrire la courbe.</li>
|
|
||||||
<li>\(p \in \mathbb{R}^N\) : tableau de points ordonnés décrivant la courbe (indices allant de 0 à N-1).</li>
|
|
||||||
<li>\(t \in [0;1]\) : paramètre de l'équation paramétrique.</li>
|
|
||||||
<li>\(n\) et \(m \in \mathbb{N}\) : variables itératives des sommations.</li>
|
|
||||||
</ul><br/>
|
|
||||||
|
|
||||||
$$bézier(t, P) = \frac{\displaystyle\sum_{n=0}^{N-1}{\frac{t^{N-n-1} n! \displaystyle\sum_{m=0}^{N-1}{\frac{(-1)^{m-n-1}m!p_{N-m-1}}{(N-m-1)!(N-2m-1)!}}}{(N-n-1)!}}}{(N-1)!}$$
|
|
||||||
|
|
||||||
<br/><ul>
|
|
||||||
<li>Avec 1 point, la courbe est ce point.</li>
|
|
||||||
<li>Avec 2 points, la courbe est un fragment de droite, le segment reliant ces deux points.</li>
|
|
||||||
<li>Avec N points, la courbe est un fragment de courbe de degré N-1, commançant au point 0 et se terminant au point N-1.</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div style="color: #222;">Geogebra tester in works : <a href="tempPreMega/bezierN.ggb" style="color: #222;">download</a> (version 201603121831)</div>
|
|
||||||
|
|
||||||
Pour ceux qui préfèrent, voici un petit algorithme récursif fonctionnant normalement pour 2 dimensions.<br/><!-- Ca fait pas beaucoup :p -->
|
|
||||||
|
|
||||||
<br/><code><!-- Je verrais plus tard pour faire un css, voir un peu de js, pour que le <code> soit plus lisible, de l interieur comme de l exterieur -->
|
|
||||||
public static Point recursiveBezier(double t,Point... p){<br/>
|
|
||||||
Point[] out = new Point[points.length-1];<br/>
|
|
||||||
for(int i = 1; i < p.length; i++)<br/>
|
|
||||||
out[i-1] = p[i-1].set(p[i-1].x + t*(p[i].x-p[i-1].x), p[i-1].y + t*(p[i].y-p[i-1].y));<br/>
|
|
||||||
return (out.lenght == 1) ? out[0] : recursiveBezier(t, out);<br/><!-- voila ta punition, mechant -->
|
|
||||||
}<br/>
|
|
||||||
</code>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<!--article id="logicAxiom">
|
|
||||||
<h2 class="articleTitle"><strong>Axiomes de la logique</strong></h2>
|
|
||||||
<a class="articlePic" href="tempPreMega/godel.png"><img src="tempPreMega/godel.png" width="128" /></a>
|
|
||||||
|
|
||||||
<div class="articleText">
|
|
||||||
<ul>
|
|
||||||
<li></li>
|
|
||||||
<ul>
|
|
||||||
</div>
|
|
||||||
</article-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<article id="administration">
|
|
||||||
<h2 class="articleTitle"><strong>Administration</strong></h2>
|
|
||||||
|
|
||||||
<div class="articleText">
|
|
||||||
<ol>
|
|
||||||
<!-- 01 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 02 --><li>Possibilité de créer des discussions</li>
|
|
||||||
<!-- 03 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 04 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 05 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 06 --><li>Possibilité d'editer ou de supprimer n'importe quel message</li>
|
|
||||||
<!-- 07 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 08 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 09 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 10 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 11 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 12 --><li>Accès en téléchargement des fichiers des projets même privés</li>
|
|
||||||
<!-- 13 --><li>Coming soon (or not)</li>
|
|
||||||
<!-- 14 --><li>Accèder à toutes les discussions (même privées)</li>
|
|
||||||
<!-- 15 --><li>Accès à la passée console d'administration</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article id="disorderer">
|
|
||||||
<h2 class="articleTitle">Formules en vrac</h2>
|
|
||||||
|
|
||||||
<div class="articleText">
|
|
||||||
<ul>
|
|
||||||
<li>\(e^{i\pi} + 1 = 0\)</li>
|
|
||||||
<li>\(\pi = \frac{9801}{2\sqrt{2} \displaystyle\sum^{+\infty}_{n=0} \frac{(4n)!}{(n!)^4} \times \frac{[1103 + 26390n]}{(4 \times 99)^{4n}}} = 6\displaystyle\sum^{+\infty}_{n=1}{\frac{1}{n^2}}\)</li>
|
|
||||||
<li>\(\begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos \alpha & -\sin \alpha \\ 0 & \sin \alpha & \cos \alpha \\ \end{pmatrix} \begin{pmatrix} \cos \beta & 0 & \sin \beta \\ 0 & 1 & 0 \\ -\sin \beta & 0 & \cos \beta \\ \end{pmatrix} \begin{pmatrix} \cos \gamma & -\sin \gamma & 0 \\ \sin \gamma & \cos \gamma & 0 \\ 0 & 0 & 1 \\ \end{pmatrix}\), la matrice de rotation dans \(\mathbb{R}^3\) d'angle \(\alpha\) autour de l'axe x, \(\beta\) autour de y et \(\gamma\) autour de z.</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
25
logging.php
25
logging.php
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
include_once 'includes/inter.php';
|
|
||||||
|
|
||||||
$result = tryToConnect();
|
|
||||||
switch($result){
|
|
||||||
case 'errormdp':
|
|
||||||
header('Location:login.php');
|
|
||||||
$_SESSION['current_error'] = 'Mot de passe incorrect ...';
|
|
||||||
break;
|
|
||||||
case 'errorpseudo':
|
|
||||||
header('Location:login.php');
|
|
||||||
$_SESSION['current_error'] = 'Nom d\'utilisateur incorrect ...';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
echo $result;
|
|
||||||
echo $_POST['mdp'];
|
|
||||||
$_SESSION['session_id'] = $result;
|
|
||||||
$_SESSION['session_mdp'] = $_POST['mdp'];
|
|
||||||
$_SESSION['current_error'] = 'Vous êtes bien connecté (vous l\'avez été et le serez également)!';
|
|
||||||
header('Location:index.php');
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<form id="loginForm" method="post" action="logging.php">
|
<form id="loginForm" method="post" action="executor.php?action=login">
|
||||||
<label for="pseudo">Pseudo :</label>
|
<label for="pseudo">Pseudo :</label>
|
||||||
<input type="text" name="pseudo" id="pseudo" placeholder="Ex:Bernard" />
|
<input type="text" name="pseudo" id="pseudo" placeholder="Ex:Bernard" />
|
||||||
<br/>
|
<br/>
|
||||||
@ -30,4 +30,4 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
25
others.php
25
others.php
@ -1,7 +1,8 @@
|
|||||||
<?php session_start(); ?>
|
<?php session_start();
|
||||||
|
include_once 'clazz/Zincluder.php';?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<?php include 'includes/meta.php'; ?>
|
<?php include 'includes/meta.php'; ?>
|
||||||
</head>
|
</head>
|
||||||
@ -12,15 +13,19 @@
|
|||||||
<h1>Tous les projets</h1>
|
<h1>Tous les projets</h1>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once 'includes/inter.php';
|
$me = Membre::me();
|
||||||
|
$projects = Projet::getOthers($me);
|
||||||
|
foreach(Utility::arrayIfNot($projects) as $project){
|
||||||
|
$version = Version::getHighestFromProject($project);
|
||||||
|
if($version)
|
||||||
|
echo ('<a href="projet.php?v='. $version->getID() .'">Le projet ' . $project->getName() . ' en version ' . $version->getName() . '</a><br/>');
|
||||||
|
else
|
||||||
|
echo ('<a href="404.php?p='. $project->getID() .'">Le projet ' . $project->getName() . ' sans version </a><br/>');
|
||||||
|
}
|
||||||
|
|
||||||
$projects = getProjectsWithFirstPermission();
|
?>
|
||||||
|
<br/>
|
||||||
foreach($projects as $project){
|
|
||||||
echo ('<a href="projet.php?id='. $project['projectID'] .'&v='. $project['versionAbs'] .'">Le projet ' . $project['projectName'] . ' en version ' . $project['versionName'] . '</a><br/>');
|
|
||||||
}
|
|
||||||
?><br/>
|
|
||||||
|
|
||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
include_once 'includes/inter.php';
|
|
||||||
|
|
||||||
if(!isConnected()){
|
|
||||||
header('Location:403.php');
|
|
||||||
goto end;
|
|
||||||
}else if(!discutExists()){ header ( 'Location:40A.php' ); goto end;}else if(preg_match("#^p$#",$disc['autorized']) || (preg_match("#^a[0-9]+$#",$disc['autorized']))?substr($disc['autorized'],1)<=$adminLevel:FALSE || preg_match('#^x([0-9];)*' . $_SESSION['session_id'] . '(;[0-9])*$#',$disc['autorized']) || $adminLevel>=14){
|
|
||||||
header('Location:401.php');
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage();
|
|
||||||
|
|
||||||
header('Location:discut.php?d='.$_GET['d']);
|
|
||||||
end:
|
|
||||||
55
profile.php
55
profile.php
@ -1,4 +1,5 @@
|
|||||||
<?php session_start(); ?>
|
<?php session_start();
|
||||||
|
include_once 'clazz/Zincluder.php' ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -7,33 +8,29 @@
|
|||||||
<body>
|
<body>
|
||||||
<?php include 'includes/header.php'; ?>
|
<?php include 'includes/header.php'; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once 'includes/inter.php';
|
$me = Membre::me();
|
||||||
|
if(!$me){
|
||||||
if(isConnected()){
|
header('Location:login.php');
|
||||||
|
$_SESSION['current_error'] = 'Veuillez vous connectez ou vous inscrire pour accéder à votre profil (ça semble logique ...)';
|
||||||
?>
|
exit;
|
||||||
<form method="post" action="change_password.php" id="changePasswordForm">
|
}
|
||||||
Changer le mot de passe :<br/>
|
?>
|
||||||
<label for="real_mdp_ask">Votre ancien mot de passe :</label>
|
|
||||||
<input type="password" id="real_mdp_ask" name="rmdp" />
|
<form method="post" action="executor.php?action=changePassword" id="changePasswordForm">
|
||||||
<br/>
|
Changer le mot de passe :<br/>
|
||||||
<label for="new_mdp2_ask">Votre nouveau mot de passe :</label>
|
<label for="real_mdp_ask">Votre ancien mot de passe :</label>
|
||||||
<input type="password" id="new_mdp_ask" name="nmdp" />
|
<input type="password" id="real_mdp_ask" name="rmdp" />
|
||||||
<br/>
|
<br/>
|
||||||
<label for="new_mdp2_ask">Répétez-le :</label>
|
<label for="new_mdp2_ask">Votre nouveau mot de passe :</label>
|
||||||
<input type="password" id="new_mdp2_ask" name="nmdp2" />
|
<input type="password" id="new_mdp_ask" name="nmdp" />
|
||||||
<br/>
|
<br/>
|
||||||
<input type="submit" value="Changer le mot de passe">
|
<label for="new_mdp2_ask">Répétez-le :</label>
|
||||||
</form>
|
<input type="password" id="new_mdp2_ask" name="nmdp2" />
|
||||||
<?php
|
<br/>
|
||||||
|
<input type="submit" value="Changer le mot de passe">
|
||||||
}else{
|
</form>
|
||||||
header('Location:register.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
211
projet.php
211
projet.php
@ -1,120 +1,103 @@
|
|||||||
<?php session_start(); ?>
|
<?php session_start(); ?>
|
||||||
<!DOCTYPE html>
|
<?php include_once 'clazz/Zincluder.php';?>
|
||||||
<html>
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<?php include 'includes/meta.php'; ?>
|
<?php include 'includes/meta.php'; ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<?php include 'includes/header.php'; ?>
|
<?php include 'includes/header.php'; ?>
|
||||||
<?php
|
<?php
|
||||||
include_once 'includes/inter.php';
|
//TODO re la fonction exiting
|
||||||
|
$me = Membre::me();
|
||||||
$permissions=array(FALSE,FALSE,FALSE,FALSE);
|
if(!isset($_GET['v'])){
|
||||||
$connected = isConnected();
|
header ( 'Location:projets.php');
|
||||||
$owner = FALSE;
|
$_SESSION ['current_error'] = 'Quand on demande des données, on donne des données !!!';
|
||||||
$adminLevel=-1;
|
exit;
|
||||||
|
|
||||||
$data = array();
|
|
||||||
if(isset($_GET['id']) && isset($_GET['v'])){
|
|
||||||
$data = getProjectVersionData($_GET['id'],$_GET['v']);
|
|
||||||
if($data != NULL){
|
|
||||||
$permissions = getPermissions($data);
|
|
||||||
}else{
|
|
||||||
header('Location:40A.php');
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
header('Location:40A.php');
|
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
if($connected)
|
$version = new Version($_GET['v']);
|
||||||
$owner = preg_match('#[^0-9]?' . $_SESSION['session_id'] .'[^0-9]?#',$data ['owners']);
|
if(!$version->exists()){
|
||||||
$adminLevel = getAdminLevel();
|
header ( 'Location:projets.php');
|
||||||
if($permissions[0] || $owner){
|
$_SESSION ['current_error'] = 'Je vais avoir du mal à afficher les donées de la version néant ...';
|
||||||
?>
|
exit;
|
||||||
|
}
|
||||||
<h1>Le projet <?php echo($data['name']) ?> en version <?php echo($data['version']) ?></h1>
|
if(count($version->getPublicFiles())<=0 && $me?$me->isAdminLevelLowerThan(12):FALSE && !$version->getProject()->haveRights()){
|
||||||
<br/>
|
header ( 'Location:projets.php');
|
||||||
<?php if($data['language'] == 0){?>
|
$_SESSION ['current_error'] = 'Vous n\'avez pas le droit d\'être ici ...<br/> DEGAGEZ !!!';
|
||||||
<a class="project_option" href=<?php if($permissions[1] OR $owner OR $adminLevel>12){ echo( '"megaProcess/downloadJar.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
exit;
|
||||||
<img class="project_option_img<?php if(!$permissions[1] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Télécharger le jar" title="Télécharger le jar" src="pictures/download_jar.png"/>
|
}
|
||||||
</a>
|
$su = $me?$version->getProject()->haveRights($me):FALSE OR $me?$me->isAdminLevelHigherThan(12):FALSE;
|
||||||
<a class="project_option" href=<?php if($permissions[2] OR $owner OR $adminLevel>12){ echo( '"megaProcess/viewJavaSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
||||||
<img class="project_option_img<?php if(!$permissions[2] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/view_code.png"/>
|
|
||||||
</a>
|
|
||||||
<a class="project_option" href=<?php if($permissions[2] OR $owner OR $adminLevel>12){ echo( '"megaProcess/downloadJavaSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
||||||
<img class="project_option_img<?php if(!$permissions[2] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_code.png"/>
|
|
||||||
</a>
|
|
||||||
<a class="project_option" href=<?php if($permissions[3] OR $owner OR $adminLevel>12){ echo( '"megaProcess/viewJavadoc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
||||||
<img class="project_option_img<?php if(!$permissions[3] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Voir la doc" title="Voir la doc" src="pictures/view_javadoc.png"/>
|
|
||||||
</a>
|
|
||||||
<a class="project_option" href=<?php if($permissions[3] OR $owner OR $adminLevel>12){ echo( '"megaProcess/downloadJavadoc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
||||||
<img class="project_option_img<?php if(!$permissions[3] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Télecharger la doc" title="Télecharger la doc" src="pictures/download_javadoc.png"/>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
<?php }else if($data['language'] == 1){?>
|
|
||||||
<a class="project_option" href=<?php if($permissions[1] OR $owner OR $adminLevel>12){ echo( '"megaProcess/downloadXlsm.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
||||||
<img class="project_option_img<?php if(!$permissions[1] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Télécharger le xlsm" title="Télécharger le xlsm" src="pictures/download_xlsm.png"/>
|
|
||||||
</a>
|
|
||||||
<a class="project_option" href=<?php if($permissions[2] OR $owner OR $adminLevel>12){ echo( '"megaProcess/viewVbSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
||||||
<img class="project_option_img<?php if(!$permissions[2] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/voir_vb.png"/>
|
|
||||||
</a>
|
|
||||||
<a class="project_option" href=<?php if($permissions[2] OR $owner OR $adminLevel>12){ echo( '"megaProcess/downloadVbSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
||||||
<img class="project_option_img<?php if(!$permissions[2] OR $owner OR $adminLevel>12){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_vb.png"/>
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
<br/>
|
|
||||||
<h3>Toutes les versions :</h3>
|
|
||||||
<br/>
|
|
||||||
<?php
|
|
||||||
$versions = getVersions($_GET ['id']);
|
|
||||||
?>
|
|
||||||
<?php if(count($versions[0]) > 0){?>
|
|
||||||
<table class="versionTable">
|
|
||||||
<tr>
|
|
||||||
<th>Java</th>
|
|
||||||
</tr>
|
|
||||||
<?php foreach ($versions[0] as $version){ ?>
|
|
||||||
<tr><td><a href = "projet.php?id=<?php echo $_GET['id']?>&v=<?php echo $version['versionAbs'];?>"><?php echo $version['versionName'] ?></a></td></tr>
|
|
||||||
<?php }?>
|
|
||||||
</table>
|
|
||||||
<?php }?>
|
|
||||||
|
|
||||||
<?php if(count($versions[1]) > 0){?>
|
|
||||||
<table class="versionTable">
|
|
||||||
<tr>
|
|
||||||
<th>VBA</th>
|
|
||||||
</tr>
|
|
||||||
<?php foreach ($versions[1] as $version){ ?>
|
|
||||||
<tr><td><a href = "projet.php?id=<?php echo $_GET['id']?>&v=<?php echo $version['versionAbs'];?>"><?php echo $version['versionName'] ?></a></td></tr>
|
|
||||||
<?php }?>
|
|
||||||
</table>
|
|
||||||
<?php }?>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
<br/>
|
|
||||||
<?php if($owner){ ?>
|
|
||||||
<a href="newVersion.php?id=<?php echo $_GET['id'];?>">Nouvelle version</a><br/>
|
|
||||||
<a href="editVersion.php?id=<?php echo $_GET['id'];?>&v=<?php echo $_GET['v'];?>">Modifier la version</a><br/>
|
|
||||||
<a href="delVersion.php?id=<?php echo $_GET['id'];?>&v=<?php echo $_GET['v'];?>">Supprimer la version</a><br/>
|
|
||||||
<a href="editProject.php?id=<?php echo $_GET['id'];?>">Modifier le projet</a><br/>
|
|
||||||
<a href="delProject.php?id=<?php echo $_GET['id'];?>">Supprimer le projet</a><br/>
|
|
||||||
<?php } ?>
|
|
||||||
<?}else{
|
|
||||||
header('Location:403.php');
|
|
||||||
goto end;
|
|
||||||
}?>
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
|
||||||
end:
|
|
||||||
?>
|
?>
|
||||||
<?php include 'includes/footer.php'; ?>
|
<h1>Le projet <?php echo($version->getProject()->getName()) ?> en version <?php echo($version->getName()) ?></h1>
|
||||||
</body>
|
<br/>
|
||||||
|
<?php if($version->getLanguage()->isJarAvalivable()){?>
|
||||||
|
<a class="project_option" href=<?php if($version->isJarPublic() OR $su){ echo( '"megaProcess/downloadJar.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isJarPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger le jar" title="Télécharger le jar" src="pictures/download_jar.png"/>
|
||||||
|
</a>
|
||||||
|
<?php }if($version->getLanguage()->isJavaAvalivable()){ ?>
|
||||||
|
<a class="project_option" href=<?php if($version->isJavaPublic() OR $su){ echo( '"megaProcess/viewJavaSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isJavaPublic() OR $su)){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/view_code.png"/>
|
||||||
|
</a>
|
||||||
|
<?php }if($version->getLanguage()->isJavaAvalivable()){ ?>
|
||||||
|
<a class="project_option" href=<?php if($version->isJavaPublic() OR $su){ echo( '"megaProcess/downloadJavaSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isJavaPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_code.png"/>
|
||||||
|
</a>
|
||||||
|
<?php }if($version->getLanguage()->isJavadocAvalivable()){ ?>
|
||||||
|
<a class="project_option" href=<?php if($version->isJavadocPublic() OR $su){ echo( '"megaProcess/viewJavadoc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isJavadocPublic() OR $su)){echo(" disabeled");} ?>" alt="Voir la doc" title="Voir la doc" src="pictures/view_javadoc.png"/>
|
||||||
|
</a>
|
||||||
|
<?php }if($version->getLanguage()->isJavadocAvalivable()){ ?>
|
||||||
|
<a class="project_option" href=<?php if($version->isJavadocPublic() OR $su){ echo( '"megaProcess/downloadJavadoc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isJavadocPublic() OR $su)){echo(" disabeled");} ?>" alt="Télecharger la doc" title="Télecharger la doc" src="pictures/download_javadoc.png"/>
|
||||||
|
</a>
|
||||||
|
<?php }if($version->getLanguage()->isXlsmAvalivable()){ ?>
|
||||||
|
<a class="project_option" href=<?php if($version->isXlsmPublic() OR $su){ echo( '"megaProcess/downloadXlsm.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isXlsmPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger le xlsm" title="Télécharger le xlsm" src="pictures/download_xlsm.png"/>
|
||||||
|
</a>
|
||||||
|
<?php }if($version->getLanguage()->isVbAvalivable()){ ?>
|
||||||
|
<a class="project_option" href=<?php if($version->isVbPublic() OR $su){ echo( '"megaProcess/viewVbSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isVbPublic() OR $su)){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/voir_vb.png"/>
|
||||||
|
</a>
|
||||||
|
<?php }if($version->getLanguage()->isVbAvalivable()){ ?>
|
||||||
|
<a class="project_option" href=<?php if($version->isVbPublic() OR $su){ echo( '"megaProcess/downloadVbSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||||
|
<img class="project_option_img<?php if(!($version->isVbPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_vb.png"/>
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
</html>
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<?php $versions = Version::getFromProject($version->getProject()); ?>
|
||||||
|
<?php if(is_array($versions)){/* = if count(versions>1) */ ?>
|
||||||
|
<?php $languages = Langage::getLanguagesFromVersions($versions); ?>
|
||||||
|
<h3>Toutes les versions :</h3>
|
||||||
|
<br/>
|
||||||
|
<?php foreach($languages as $language){ ?>
|
||||||
|
<table class="versionTable">
|
||||||
|
<tr>
|
||||||
|
<th><?php echo $language->getName(); ?></th>
|
||||||
|
</tr>
|
||||||
|
<?php foreach (Utility::arrayIfNot($versions) as $writingVersion){if($writingVersion->getLanguage() == $language){ ?>
|
||||||
|
<tr><td><a href = "projet.php?v=<?php echo $writingVersion->getID();?>"><?php echo $writingVersion->getName(); ?></a></td></tr>
|
||||||
|
<?php }}?>
|
||||||
|
</table>
|
||||||
|
<?php } ?>
|
||||||
|
<?php }?>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<?php if($me?$version->getProject()->haveRights($me):FALSE){ ?>
|
||||||
|
<a href="newVersion.php?id=<?php echo $_GET['id'];?>">Nouvelle version</a><br/>
|
||||||
|
<a href="editVersion.php?id=<?php echo $_GET['id'];?>&v=<?php echo $_GET['v'];?>">Modifier la version</a><br/>
|
||||||
|
<a href="delVersion.php?id=<?php echo $_GET['id'];?>&v=<?php echo $_GET['v'];?>">Supprimer la version</a><br/>
|
||||||
|
<a href="editProject.php?id=<?php echo $_GET['id'];?>">Modifier le projet</a><br/>
|
||||||
|
<a href="delProject.php?id=<?php echo $_GET['id'];?>">Supprimer le projet</a><br/>
|
||||||
|
<?php } ?>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php include 'includes/footer.php'; ?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
59
projets.php
59
projets.php
@ -1,32 +1,35 @@
|
|||||||
<?php session_start(); ?>
|
<?php session_start();
|
||||||
<!DOCTYPE html>
|
include_once 'clazz/Zincluder.php';?>
|
||||||
<html>
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<?php include 'includes/meta.php'; ?>
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<?php include 'includes/meta.php'; ?>
|
<?php include 'includes/header.php'; ?>
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<h1>Mes projets</h1>
|
||||||
<?php include 'includes/header.php'; ?>
|
|
||||||
|
|
||||||
<h1>Mes projets</h1>
|
<?php
|
||||||
|
|
||||||
<?php
|
if($me = Membre::me()){//Defini dans le header.php
|
||||||
include_once 'includes/inter.php';
|
$projects = Projet::getWhichHeCanAccess($me);
|
||||||
|
foreach(Utility::arrayIfNot($projects) as $project){
|
||||||
if(isConnected()){
|
$version = Version::getHighestFromProject($project);
|
||||||
|
if($version)
|
||||||
$projects = getOwnersisProjects();
|
echo ('<a href="projet.php?v='. $version->getID() .'">Le projet ' . $project->getName() . ' en version ' . $version->getName() . '</a><br/>');
|
||||||
foreach($projects as $project){
|
else
|
||||||
echo ('<a href="projet.php?id='. $project['projectID'] .'&v='. $project['versionAbs'] .'">Le projet ' . $project['projectName'] . ' en version ' . $project['versionName'] . '</a><br/>');
|
echo ('<a href="404.php?p='. $project->getID() .'">Le projet ' . $project->getName() . ' sans version </a><br/>');
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
header('Location:401.php');
|
header ( 'Location:login.php');
|
||||||
}
|
$_SESSION ['current_error'] = 'C\'est pas que je veut pas ... mais qui êtes vous ?';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<br/>
|
<br/>
|
||||||
<?php include 'includes/footer.php'; ?>
|
<?php include 'includes/footer.php'; ?>
|
||||||
</body>
|
</body>
|
||||||
|
</html>
|
||||||
</html>
|
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start ();
|
|
||||||
|
|
||||||
include_once 'includes/inter.php';
|
|
||||||
|
|
||||||
if (isset ( $_POST ['pseudo'] ) && isset ( $_POST ['mdp'] ) && isset ( $_POST ['mdp2'] )) {
|
|
||||||
|
|
||||||
if ($_POST ['mdp'] === $_POST ['mdp2']) {
|
|
||||||
|
|
||||||
if (preg_match ( "#^[a-zA-Z0-9\\-_]+$#", $_POST ['pseudo'] )) {
|
|
||||||
|
|
||||||
if (preg_match ( "#^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\-_&éèàùçµ\"\\#'{}()[\\]|\\^@°+=\$¤£*!§:/;.,?²]+$#", $_POST ['mdp'] )) {
|
|
||||||
|
|
||||||
switch (registerPerson ( $_POST ['pseudo'], $_POST ['mdp'] )) {
|
|
||||||
|
|
||||||
case 'ok' :
|
|
||||||
|
|
||||||
$_SESSION ['current_error'] = 'Vous avez déjà été correctement inscrit sur bernard.com';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'usedPseudo' :
|
|
||||||
$_SESSION ['current_error'] = 'Le pseudonyme est déjà utilisé (par une entité differente de vous)';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$_SESSION ['current_error'] = 'Le mot de passe fut incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_&éèàùçµ"#\'{}()[]|^@°+=$¤£*!§:/;.,?²';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$_SESSION ['current_error'] = 'Le pseudo sera incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$_SESSION ['current_error'] = 'Tu auras du rentrer deux fois le même mot de passe (tu permet aussi de rendre le champs "Recopier le mot de passe" utile)';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$_SESSION ['current_error'] = 'Quand on demande des données , on donne des données !!!';
|
|
||||||
}
|
|
||||||
header ( 'Location:register.php' );
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
39
todo.list
39
todo.list
@ -1,7 +1,36 @@
|
|||||||
discuts.php
|
--- Debug ---
|
||||||
createDiscuts.php
|
projet.php : publicy -> authorizedGroup
|
||||||
sendMessage.php
|
|
||||||
|
|
||||||
|
--- Lacunes de fonctionnalité ---
|
||||||
|
Bouton "Editer le message" + Ajout de lastModifDate
|
||||||
|
Boutton "créer un projet"
|
||||||
|
Page article.php
|
||||||
|
⤷ Commentaires (message.messageType=1)
|
||||||
|
⤷ Edit / Update
|
||||||
|
Boutton "créer un article"
|
||||||
|
|
||||||
MEGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
Page admin
|
||||||
version edit + editing
|
Change file accessibility mechanism
|
||||||
|
Make tag mechanism more beautyful
|
||||||
|
|
||||||
|
Add text "There is no discussion you can access" (count < 1)
|
||||||
|
|
||||||
|
MEGA !!!
|
||||||
|
|
||||||
|
Sockets pour discut.php -> http://www.raphael-goncalves.fr/blog/chat-temps-reel-en-php-avec-des-websocket
|
||||||
|
|
||||||
|
--- Nouvelles fonctionnalités ---
|
||||||
|
|
||||||
|
SmartURL (pour changements d'ID ou suppression) : b.com/projets/cercloidator ; b.com/projets/cercloidator/3.1415
|
||||||
|
|
||||||
|
Source code viewer
|
||||||
|
|
||||||
|
"Linux,42,nulix ..." bouton caché dans 404 texte infini amène vers la page de la conspiration microsoftienne
|
||||||
|
|
||||||
|
--- Nouveau projet ---
|
||||||
|
|
||||||
|
Zarbination aléatoire de bernard.com (https://www.dafont.com/fr/unown.font)
|
||||||
|
Bdd utilitary
|
||||||
|
RER plan simulator
|
||||||
|
Pokemon version maths (Discord:Bernard:376096618891444224)
|
||||||
|
Convertisseur d'unitées communautaire (les utilisateurs créent des methodes "XtoMètre(double val) et MètretoX(double val)" et les publient)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user