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
|
||||
43
404.php
43
404.php
@ -18,42 +18,17 @@
|
||||
|
||||
<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:
|
||||
include 'allein/pieces.php';
|
||||
break;
|
||||
default:
|
||||
include 'allein/univers.php';
|
||||
|
||||
<!---->
|
||||
<div id="universe_text"></div>
|
||||
|
||||
<div id="add_universe" style="width:34px;height:21px;">
|
||||
Plus
|
||||
<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'; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
432
admin.php
432
admin.php
@ -1,6 +1,10 @@
|
||||
<?php
|
||||
include_once 'clazz/Zincluder.php;';
|
||||
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->connect ( $_SESSION ['session_mdp'] );
|
||||
if ($me->isAdminLevelLowerThan ( 15 )) {
|
||||
@ -10,167 +14,293 @@ if ($me->isAdminLevelLowerThan ( 15 )) {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/adminStyle.css" />
|
||||
<meta charset="utf-8" />
|
||||
<title>La console d'admin</title>
|
||||
</head>
|
||||
<body>
|
||||
<script
|
||||
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/adminStyle.css"/>
|
||||
<meta charset="utf-8"/>
|
||||
<title>La console d'admin</title>
|
||||
</head>
|
||||
<body>
|
||||
<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>
|
||||
<option value="bdd">bdd</option>
|
||||
</select><br/>
|
||||
</div>
|
||||
|
||||
<div id="setDiv">
|
||||
<div class="commander" id="getCommander" style="display: block;">
|
||||
<label for="getCommanderCibleSelector">Cible :</label>
|
||||
<input type="text" id="getCommanderCibleSelector" alt="Un selecteur" title="Un selecteur"/>
|
||||
</div>
|
||||
|
||||
<div class="commander" id="setCommander" style="display: none;">
|
||||
<label for="setCommanderCibleSelector">Cible :</label>
|
||||
<input type="text" id="setCommanderCibleSelector" alt="Un selecteur" title="Un selecteur"/><br/>
|
||||
|
||||
<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/>
|
||||
|
||||
<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>
|
||||
|
||||
<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;
|
||||
}
|
||||
}
|
||||
$('#commandSelector').change(updateCommandSelector);
|
||||
|
||||
function updateAddCommandClassSelector(){
|
||||
$('div.addDivAttribute').hide();
|
||||
switch($('#addClassSelector').val()){
|
||||
case 'membre':
|
||||
$('#addDivAttributeMembre').show();
|
||||
break;
|
||||
case 'discussion':
|
||||
$('#addDivAttributeDiscussion').show();
|
||||
break;
|
||||
case 'message':
|
||||
$('#addDivAttributeMessage').show();
|
||||
break;
|
||||
case 'projet':
|
||||
$('#addDivAttributeProjet').show();
|
||||
break;
|
||||
case 'version':
|
||||
$('#addDivAttributeVersion').show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
$('#addClassSelector').change(updateAddCommandClassSelector);
|
||||
|
||||
updateCommandSelector();
|
||||
updateAddCommandClassSelector();
|
||||
|
||||
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>');
|
||||
$($('#addProjetAddPocesseur').prev().children()[0]).keyup(updateCommandOutput);
|
||||
|
||||
$('#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(){
|
||||
|
||||
}
|
||||
$('#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>
|
||||
<br />
|
||||
<button id="switchMode">Passer en mode commande</button>
|
||||
</section>
|
||||
<br/>
|
||||
<section class="reponce">
|
||||
<h3>Dialogue :</h3>
|
||||
<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;
|
||||
|
||||
}
|
||||
newForm.append('<br/>');
|
||||
newForm.append('<button id="selectorAbort">Annuler</button>')
|
||||
newForm.append('<button id="selectorDone">Terminé</button>');
|
||||
$('form.selectorForm').replaceWith(newForm);
|
||||
}
|
||||
function selectorNode(name,primitive,array,number){
|
||||
var span = $('<span></span>');
|
||||
span.append('<input type="checkbox" />')
|
||||
span.append('<h5>'+name+'</h5>')
|
||||
if(number)
|
||||
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>')
|
||||
else if(array)
|
||||
span.append('<select><option value="in">∈</option><option value="nn">∉</option></select>')
|
||||
else
|
||||
span.append('<select><option value="ee">=</option><option value="ne">≠</option></select>')
|
||||
if(primitive)
|
||||
span.append('<input type="text" />')
|
||||
else
|
||||
span.append('<button id="'+name+'Selector">Selecteur</button>')
|
||||
}
|
||||
|
||||
function genClassesSelectors{
|
||||
$('select.classSelector')
|
||||
.append('<option value="membre">Membre</option>')
|
||||
.append('<option value="projet">Projet</option>')
|
||||
.append('<option value="version">Version</option>')
|
||||
.append('<option value="discussion">Discussion</option>')
|
||||
.append('<option value="message">Message</option>');
|
||||
}
|
||||
$(window).load(genClassesSelectors);
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</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();
|
||||
$pos=0;
|
||||
while ($pos<strlen($command)) {
|
||||
|
||||
echo $pos;
|
||||
$nomme = array();
|
||||
$type=$command[$pos];
|
||||
if(isAlphabetic($type)){
|
||||
@ -181,12 +181,10 @@ while ($pos<strlen($command)) {
|
||||
}
|
||||
|
||||
|
||||
//DEBUG
|
||||
/*
|
||||
|
||||
echo '<pre>';
|
||||
print_r($nommes);
|
||||
echo '</pre>';
|
||||
*/
|
||||
|
||||
function exception($reason){
|
||||
echo 'An exception occurred : '.$reason;
|
||||
@ -269,8 +267,7 @@ if($nommes[0][0] == 'a'){
|
||||
}
|
||||
echo '<br/><pre>';
|
||||
print_r($objectsToSet);
|
||||
echo '</pre>';+
|
||||
|
||||
echo '</pre>';
|
||||
|
||||
break;
|
||||
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()){
|
||||
$this->valid = TRUE;
|
||||
$this->name = $rep['name'];
|
||||
$this->creatorID = new Membre($rep['creatorID']);
|
||||
$this->creator = new Membre($rep['creatorID']);
|
||||
$this->dateCreation = $rep['dateCreation'];
|
||||
$this->accessibility = $rep['accessibility'];
|
||||
}else{
|
||||
@ -35,7 +35,7 @@ class Discussion{
|
||||
$out .= '\tCreator:{' . substr(str_replace('\n\t',';',$this->creator->__toString()),0,-1) . '}\n';
|
||||
$out .= '\tDate of creation:' . $this->dateCreation . '\n';
|
||||
$out .= '\tAccessibility:' . $this->accessibility . '\n';
|
||||
return out;
|
||||
return $out;
|
||||
}
|
||||
|
||||
//Getters
|
||||
@ -48,7 +48,7 @@ class Discussion{
|
||||
}
|
||||
|
||||
public function getCreator(){
|
||||
return $creator;
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
public function getDateCreation(){
|
||||
@ -62,13 +62,24 @@ class Discussion{
|
||||
|
||||
//Useful Getters
|
||||
public function canAccess($membre){
|
||||
$out = $this->accessibility === 'p';
|
||||
$out = $out or $membre->getID() === $this->creator->getID();
|
||||
if($this->accessibility === 'p')
|
||||
return TRUE;
|
||||
if($membre->getID() === $this->creator->getID())
|
||||
return TRUE;
|
||||
if(preg_match ( "#^a[0-9]+$#", $this->accessibility ) == 1)
|
||||
$out = $out or intval ( substr ( $this->accessibility, 1 ) ) <= $membre->getAdminLevel();
|
||||
$out = $out or preg_match ( '#^x([0-9]+;)*' . $membre->getID() . '(;[0-9]+)*$#', $disc ['autorized'] ) == 1;
|
||||
$out = $out or $membre->getAdminLevel() >= 14;
|
||||
return $out;
|
||||
if(intval ( substr ( $this->accessibility, 1 ) ) <= $membre->getAdminLevel())
|
||||
return TRUE;
|
||||
if(preg_match ( '#^x([0-9]+,)*' . $membre->getID() . '(,[0-9]+)*$#', $this->accessibility ))
|
||||
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){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE name=?');
|
||||
$req->execute(array($name));
|
||||
return discussionGetterOutput($req);
|
||||
return Discussion::discussionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromCreator($creator){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
|
||||
$req->execute(array($creator->getID()));
|
||||
return discussionGetterOutput($req);
|
||||
return Discussion::discussionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromDateCreation($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation=?');
|
||||
$req->execute(array($date));
|
||||
return discussionGetterOutput($req);
|
||||
return Discussion::discussionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromAccessibility($accessibility){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE creatorID=?');
|
||||
$req->execute(array($accessibility));
|
||||
return discussionGetterOutput($req);
|
||||
return Discussion::discussionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getCreatedLaterThan($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation>?');
|
||||
$req->execute(array($date));
|
||||
return discussionGetterOutput($req);
|
||||
return Discussion::discussionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getCreatedEarlierThan($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM discussions WHERE dateCreation<?');
|
||||
$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){
|
||||
@ -170,7 +187,7 @@ class Discussion{
|
||||
$out = array();
|
||||
while ( $rep = $req->fetch()) {
|
||||
$disc = new Discussion($rep['ID']);
|
||||
if ($disc->canAccess($membre))
|
||||
if ($disc->canAccess($he))
|
||||
$out[] = $disc;
|
||||
}
|
||||
if($out)
|
||||
@ -178,6 +195,24 @@ class Discussion{
|
||||
else
|
||||
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
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ class Langage{
|
||||
public static $java;
|
||||
public static $vba;
|
||||
|
||||
protected static $languages = array();
|
||||
public static $languages = array();
|
||||
|
||||
protected $ID;
|
||||
protected $name;
|
||||
@ -16,7 +16,7 @@ class Langage{
|
||||
$this->ID = $ID;
|
||||
$this->name = $name;
|
||||
$this->avalivableFiles = explode(" ",$avalivableFiles);
|
||||
$languages[] = $this;
|
||||
Langage::$languages[] = $this;
|
||||
}
|
||||
|
||||
public function getID(){
|
||||
@ -45,12 +45,20 @@ class Langage{
|
||||
}
|
||||
|
||||
public static function getFromID($ID){
|
||||
foreach(self::$languages AS $language){
|
||||
foreach(Langage::$languages AS $language){
|
||||
if($language->getID() == $ID)
|
||||
return $language;
|
||||
}
|
||||
//var_dump(Langage::$languages);
|
||||
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");
|
||||
|
||||
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 .= '\tRequired banner:' . $this->requiredBanner . '\n';
|
||||
$out .= '\tPersonnal message:' . $this->personnalMessage . '\n';
|
||||
return out;
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function isConnected(){
|
||||
@ -95,7 +95,7 @@ class Membre {
|
||||
}
|
||||
|
||||
public function isAdminLevelGreaterThan($min){
|
||||
return $this->adminLevel>$max;
|
||||
return $this->adminLevel>$min;
|
||||
}
|
||||
|
||||
public function isAdminLevelLowerOrEqualThan($max){
|
||||
@ -120,7 +120,7 @@ class Membre {
|
||||
public function changePassword($newPassword){
|
||||
if(strlen($newPassword)>255)
|
||||
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));
|
||||
return Membre::PASSWORD_CHANGED;
|
||||
}
|
||||
@ -248,7 +248,7 @@ class Membre {
|
||||
$operator = Utility::getIntegerSqlOperator($restriction[1]);
|
||||
break;
|
||||
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;
|
||||
exit;
|
||||
}
|
||||
@ -316,31 +316,40 @@ class Membre {
|
||||
}
|
||||
|
||||
public static function getFromPseudo($pseudo){
|
||||
return getFromAttributes(array(['pseudo','=',$pseudo]));
|
||||
return Membre::getFromAttributes(array(['pseudo','=',['"',$pseudo]]));
|
||||
}
|
||||
|
||||
public static function getFromAdminLevel($level){
|
||||
return getFromAttributes(array(['adminLevel','=',$level]));
|
||||
return Membre::getFromAttributes(array(['adminLevel','=',['0',$level]]));
|
||||
}
|
||||
|
||||
public static function getFromDateCreation($date){
|
||||
return getFromAttributes(array(['dateCreation','=',$date]));
|
||||
return Membre::getFromAttributes(array(['dateCreation','=',['0',$date]]));
|
||||
}
|
||||
|
||||
public static function getCreatedLaterThan($date){
|
||||
return getFromAttributes(array(['dateCreation','>',$date]));
|
||||
return Membre::getFromAttributes(array(['dateCreation','>',['"',$date]]));
|
||||
}
|
||||
|
||||
public static function getCreatedEarlierThan($date){
|
||||
return getFromAttributes(array(['dateCreation','<',$date]));
|
||||
return Membre::getFromAttributes(array(['dateCreation','<',['"',$date]]));
|
||||
}
|
||||
|
||||
public static function getAdminGreaterThan($min){
|
||||
return getFromAttributes(array(['adminLevel','>',$min]));
|
||||
return Membre::getFromAttributes(array(['adminLevel','>',['0',$min]]));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -353,6 +362,11 @@ class Membre {
|
||||
return Membre::PERSON_REGISTERED;
|
||||
}
|
||||
|
||||
//Operateurs
|
||||
public function __is_identical($copain){
|
||||
return $this->getID() == $copain->getID();
|
||||
}
|
||||
|
||||
|
||||
//Outputs texts
|
||||
|
||||
|
||||
@ -16,8 +16,8 @@ class Message{
|
||||
if($rep = $req->fetch()){
|
||||
$this->valid = TRUE;
|
||||
$this->sender = new Membre($rep['senderID']);
|
||||
$this->sendDate = $rep['sendDate'];
|
||||
$this->text = $rep['text'];
|
||||
$this->sendDate = $rep['sendTime'];
|
||||
$this->text = $rep['texte'];
|
||||
$this->discussion = new Discussion($rep['discussionID']);
|
||||
}else{
|
||||
$this->valid = FALSE;
|
||||
@ -78,7 +78,7 @@ class Message{
|
||||
private static function messagesGetterOutput($req){
|
||||
$out = array();
|
||||
while($rep = $req->fetch())
|
||||
$out[] = new Discussion($rep['ID']);
|
||||
$out[] = new Message($rep['ID']);
|
||||
switch(count($out)){
|
||||
case 0:
|
||||
return NULL;
|
||||
@ -92,45 +92,52 @@ class Message{
|
||||
public static function getFromSender($param) {
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE senderID=?');
|
||||
$req->execute(array($sender->getID()));
|
||||
return messagesGetterOutput($req);
|
||||
return Message::messagesGetterOutput($req);
|
||||
}
|
||||
|
||||
|
||||
public static function getFromSendDate($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate=?');
|
||||
$req->execute(array($date));
|
||||
return messagesGetterOutput($req);
|
||||
return Message::messagesGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getSendedLaterThan($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate>?');
|
||||
$req->execute(array($date));
|
||||
return messagesGetterOutput($req);
|
||||
return Message::messagesGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getSendedEarlierThan($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE sendDate<?');
|
||||
$req->execute(array($date));
|
||||
return messagesGetterOutput($req);
|
||||
return Message::messagesGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromText($text) {
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE text=?');
|
||||
$req->execute(array($text));
|
||||
return messagesGetterOutput($req);
|
||||
return Message::messagesGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromDiscussion($discut){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM messages WHERE discussionID=?');
|
||||
$req->execute(array($discut->getID()));
|
||||
return messagesGetterOutput($req);
|
||||
return Message::messagesGetterOutput($req);
|
||||
}
|
||||
|
||||
|
||||
//Message creator
|
||||
public static function sendMessage($sender,$discussion,$text){
|
||||
$req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO messages(discussion_id,texte,senderID,sendTime) VALUES (?,?,?,NOW())' );
|
||||
$req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO messages(discussionID,texte,senderID,sendTime) VALUES (?,?,?,NOW())' );
|
||||
$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 $owner;
|
||||
protected $secondaryOwners;
|
||||
protected $publik;
|
||||
|
||||
protected $valid;
|
||||
|
||||
@ -19,8 +20,9 @@ class Projet{
|
||||
$this->owner = new Membre($rep['ownerID']);
|
||||
$this->dateCreation = $rep['dateCreation'];
|
||||
$this->secondaryOwners = array();
|
||||
foreach (explode(';',$rep['secondaryOwners']) AS $secondaryOwner)
|
||||
foreach (explode(';',$rep['secondaryOwnersID']) AS $secondaryOwner)
|
||||
$this->secondaryOwners[] = new Membre($secondaryOwner);
|
||||
$this->publik = $rep['public'];
|
||||
}else{
|
||||
$this->valid = FALSE;
|
||||
}
|
||||
@ -38,7 +40,7 @@ class Projet{
|
||||
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;
|
||||
return $out;
|
||||
}
|
||||
|
||||
//Getters
|
||||
@ -62,10 +64,14 @@ class Projet{
|
||||
return $this->dateCreation;
|
||||
}
|
||||
|
||||
public function isPublic(){
|
||||
return $this->publik == 1;
|
||||
}
|
||||
|
||||
|
||||
//Useful getters
|
||||
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
|
||||
@ -92,7 +98,7 @@ class Projet{
|
||||
private static function projectGetterOutput($req){
|
||||
$out = array();
|
||||
while($rep = $req->fetch())
|
||||
$out[] = new Project($rep['ID']);
|
||||
$out[] = new Projet($rep['ID']);
|
||||
switch(count($out)){
|
||||
case 0:
|
||||
return NULL;
|
||||
@ -104,19 +110,19 @@ class Projet{
|
||||
}
|
||||
|
||||
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));
|
||||
return projectGetterOutput($req);
|
||||
}
|
||||
|
||||
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()));
|
||||
return projectGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromSecondaryOwner($secondaryOwner){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets');
|
||||
$req->execute();
|
||||
$out = array();
|
||||
while ($rep = $req->fetch()) {
|
||||
@ -141,25 +147,44 @@ class Projet{
|
||||
}
|
||||
|
||||
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));
|
||||
return projectGetterOutput($req);
|
||||
}
|
||||
|
||||
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));
|
||||
return projectGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getWhichHeCanAccess($he){
|
||||
//TODO Faire la selection directement grâce à une requette SQL
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM project');
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM projets');
|
||||
$req->execute(array());
|
||||
$out = array();
|
||||
while ( $rep = $req->fetch()) {
|
||||
$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;
|
||||
}
|
||||
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 $project;
|
||||
protected $language;
|
||||
protected $versionAbs;
|
||||
|
||||
public function __construct($ID){
|
||||
$this->ID = $ID;
|
||||
@ -15,12 +16,13 @@ class Version{
|
||||
$req->execute(array($ID));
|
||||
if($rep = $req->fetch()){
|
||||
$this->valid = TRUE;
|
||||
$this->name = $rem['name'];
|
||||
$this->name = $rep['name'];
|
||||
$this->sendDate = $rep['sendDate'];
|
||||
$this->publicFiles = explode(" ",$rep['publicFiles']);
|
||||
$this->tags = explode(" ",$rep['tags']);
|
||||
$this->project = new Project($rep['projectID']);
|
||||
$this->language = Langage::getFromID($rep['languageID']);
|
||||
$this->project = new Projet($rep['projectID']);
|
||||
$this->language = Langage::getFromID(intval($rep['languageID']));
|
||||
$this->versionAbs = $rep['versionAbs'];
|
||||
}else{
|
||||
$this->valid = FALSE;
|
||||
}
|
||||
@ -31,6 +33,7 @@ class Version{
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
try{
|
||||
$out = 'Version\n';
|
||||
$out .= '\tID:' . $this->ID . '\n';
|
||||
$out .= '\tName:{' . $this->name . '}\n';
|
||||
@ -39,7 +42,12 @@ class Version{
|
||||
$out .= '\tTags:"' . implode(' ',$this->tags) . '"}\n';
|
||||
$out .= '\tProject:' . substr(str_replace('\n\t',';',$this->project->__toString()),0,-1) . '\n';
|
||||
$out .= '\tLanguage:' . $this->language->getName() . '\n';
|
||||
return out;
|
||||
$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;
|
||||
}
|
||||
|
||||
public function getVersionAbs(){
|
||||
return $this->versionAbs;
|
||||
}
|
||||
|
||||
//Useful Getters
|
||||
//TODO make all of the following 'is' functions using haveTag
|
||||
public function haveTag($tag){
|
||||
@ -249,19 +261,25 @@ class Version{
|
||||
public static function getFromLanguage($language){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE languageID=?');
|
||||
$req->execute(array($language->getID()));
|
||||
return versionGetterOutput($req);
|
||||
return Version::versionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromProject($project){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE projectID=?');
|
||||
$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){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE name=?');
|
||||
$req->execute(array($name));
|
||||
return versionGetterOutput($req);
|
||||
return Version::versionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromTag($tag){
|
||||
@ -282,28 +300,25 @@ class Version{
|
||||
return $out;
|
||||
}
|
||||
|
||||
return projectGetterOutput($req);
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE languageID=?');
|
||||
$req->execute(array($language->getID()));
|
||||
return versionGetterOutput($req);
|
||||
return Version::versionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getFromSendDate($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate=?');
|
||||
$req->execute(array($date));
|
||||
return versionsGetterOutput($req);
|
||||
return Version::versionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getSendedLaterThan($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate>?');
|
||||
$req->execute(array($date));
|
||||
return versionsGetterOutput($req);
|
||||
return Version::versionGetterOutput($req);
|
||||
}
|
||||
|
||||
public static function getSendedEarlierThan($date){
|
||||
$req = $GLOBALS['bdd']->prepare('SELECT * FROM versions WHERE sendDate<?');
|
||||
$req->execute(array($date));
|
||||
return versionsGetterOutput($req);
|
||||
return Version::versionGetterOutput($req);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
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', '*******************');
|
||||
}catch(Exception $e){
|
||||
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
|
||||
include_once 'clazz/Utility.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/Message.class.php';
|
||||
include_once 'clazz/Projet.class.php';
|
||||
include_once 'clazz/Article.class.php';
|
||||
//TODO Use class's consts for file names
|
||||
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{
|
||||
text-align: left;
|
||||
margin: 25px 125px;
|
||||
margin: 5%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
@ -129,7 +129,7 @@ footer {
|
||||
|
||||
#bande {
|
||||
display: block;
|
||||
padding-bottom: 5px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
@ -268,11 +268,26 @@ section.message div {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Disposition with width */
|
||||
.nav2x2 {
|
||||
samp#universe_text{
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* HEADER STYLE */
|
||||
.nav3x2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#navLinks a {
|
||||
display: inline-block;
|
||||
width: 250px;
|
||||
font-size: 3ex;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.navV {
|
||||
display: none;
|
||||
}
|
||||
@ -295,21 +310,13 @@ section.message div {
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1180px) { /* Afficher nav2x2 */
|
||||
.nav2x2 {
|
||||
@media screen and (max-width: 1180px) { /* Afficher nav3x2 */
|
||||
.nav2x3 {
|
||||
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 {
|
||||
display: inline;
|
||||
}
|
||||
@ -317,7 +324,5 @@ section.message div {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
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:
|
||||
99
discut.php
99
discut.php
@ -1,45 +1,56 @@
|
||||
<?php
|
||||
session_start ();
|
||||
|
||||
include_once 'includes/inter.php';
|
||||
|
||||
?><!DOCTYPE html><html><head>
|
||||
<?php session_start ();
|
||||
include_once 'clazz/Zincluder.php'; ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<?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'; ?>
|
||||
<br />
|
||||
|
||||
<?php
|
||||
|
||||
$disc = getDiscutInfos ();
|
||||
|
||||
$adminLevel = - 1;
|
||||
|
||||
if (isConnected ())
|
||||
|
||||
$adminLevel = getAdminLevel ();
|
||||
|
||||
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:403.php' );
|
||||
|
||||
goto end;
|
||||
} else if (! discutExists ()) {
|
||||
|
||||
header ( 'Location:40A.php' );
|
||||
|
||||
goto end;
|
||||
//TODO re la fonction exiting
|
||||
$me = Membre::me();
|
||||
if(!isset($_GET['d'])){
|
||||
header ( 'Location:discuts.php');
|
||||
$_SESSION ['current_error'] = 'Quand on demande des données, on donne des données !!!';
|
||||
exit;
|
||||
}
|
||||
|
||||
else if (isConnected ()) {
|
||||
|
||||
?>
|
||||
<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>
|
||||
<!-- 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>
|
||||
$discut = new Discussion($_GET['d']);
|
||||
if(!$discut->exists()){
|
||||
header ( 'Location:discuts.php');
|
||||
$_SESSION ['current_error'] = 'Je vais avoir du mal à afficher les donées de la version néant ...';
|
||||
exit;
|
||||
}
|
||||
if($me?!$discut->canAccess($me):!$discut->isPublic()){
|
||||
header ( 'Location:discuts.php');
|
||||
$_SESSION ['current_error'] = 'Vous n\'avez pas le droit d\'être ici ...<br/> DEGAGEZ !!!';
|
||||
exit;
|
||||
}
|
||||
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>
|
||||
<input type="submit" value="Poster le message">
|
||||
</form>
|
||||
<!-- TODO : Entrée->envoyer le message (dégeulasse) -->
|
||||
<script type="text/javascript">
|
||||
//Entrée -> envoi
|
||||
$('#postMessageForm textarea').on('keypress',function(e){
|
||||
if(e.which == 13){
|
||||
$('#postMessageForm input').trigger('click');
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php }else{ ?>
|
||||
<div>Vous devez vous connecter pour envoyer des messages !</div>
|
||||
<?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 -->
|
||||
<main></main>
|
||||
|
||||
<script type="text/javascript" defer>
|
||||
function reloadEditListeners(){
|
||||
$('.editLink').on('click',function(e){
|
||||
editingLink = e.target;
|
||||
@ -51,8 +62,9 @@ include_once 'includes/inter.php';
|
||||
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.target.innerHTML = 'Supression';
|
||||
window.clearTimeout(currentClock);
|
||||
$.post('executor.php?action=deleteMessage&m='+$(e.target).data('messageID'),{},askData);
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
@ -64,10 +76,15 @@ include_once 'includes/inter.php';
|
||||
});
|
||||
});
|
||||
}
|
||||
</script> <!-- Messages download --> <script type="text/javascript"> var currentClock = null;
|
||||
</script>
|
||||
|
||||
<!-- Messages download -->
|
||||
<script type="text/javascript">
|
||||
var currentClock = null;
|
||||
|
||||
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 newData = eval(data);
|
||||
@ -115,6 +132,8 @@ include_once 'includes/inter.php';
|
||||
}
|
||||
$(document).ready(askData);
|
||||
</script>
|
||||
|
||||
<!-- Edit message div -->
|
||||
<div id="editMessageFullScreen" class="fullscreen absent">
|
||||
<div class="screen-vertical-centered">
|
||||
<div class="screen-horizontal-centered">
|
||||
@ -127,4 +146,6 @@ include_once 'includes/inter.php';
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</body></html><?php end: ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
56
discuts.php
56
discuts.php
@ -1,44 +1,48 @@
|
||||
<?php
|
||||
session_start ();
|
||||
|
||||
include_once 'includes/inter.php';
|
||||
|
||||
?><!DOCTYPE html><html><head>
|
||||
include_once 'clazz/Zincluder.php';?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<?php include 'includes/meta.php'; ?>
|
||||
</head><body>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include 'includes/header.php'; ?>
|
||||
<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/>';
|
||||
$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(isConnected() && getAdminLevel()>=2){?>
|
||||
<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">
|
||||
|
||||
|
||||
|
||||
<?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 />
|
||||
</script>
|
||||
<br />
|
||||
<br />
|
||||
<?php }?>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</body></html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -9,16 +9,6 @@ include_once 'includes/inter.php';
|
||||
</head>
|
||||
<body>
|
||||
<?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 />
|
||||
@ -42,5 +32,3 @@ include_once 'includes/inter.php';
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php end:
|
||||
?>
|
||||
199
executor.php
199
executor.php
@ -1,43 +1,182 @@
|
||||
<?php
|
||||
session_start ();
|
||||
include_once 'clazz/Membre.class.php';
|
||||
$me = new Membre ();
|
||||
include_once 'clazz/Zincluder.php';
|
||||
$me = Membre::me();
|
||||
/*
|
||||
TODO add $_GET['p'] => should return on $_SESSION ['current_error'] (0) or via echo (1)
|
||||
*/
|
||||
|
||||
if (! isset ( $_GET ['action'] )) {
|
||||
header ( 'Location:40A.php' );
|
||||
exit();
|
||||
function exiting($message,$location='register.php'){
|
||||
header ( 'Location:' . $location );
|
||||
$_SESSION ['current_error'] = $message;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
if (! isset ( $_GET ['action'] ))
|
||||
exiting(NULL,'40A.php');
|
||||
|
||||
|
||||
switch ($_GET ['action']) {
|
||||
case 'register' :
|
||||
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'] )) {
|
||||
//Action : register
|
||||
if (!(isset ( $_POST ['pseudo'] ) && isset ( $_POST ['mdp'] ) && isset ( $_POST ['mdp2'] )))
|
||||
exiting('Quand on demande des données, on donne des données !!!');
|
||||
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)');
|
||||
if (preg_match ( "#^[a-zA-Z0-9\\-_]+$#", $_POST ['pseudo'] ))
|
||||
exiting('Le pseudo sera incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_');
|
||||
if (preg_match ( "#^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\-_&éèàùçµ\"\\#'{}()[\\]|\\^@°+=\$¤£*!§:/;.,?²]+$#", $_POST ['mdp'] ))
|
||||
exiting('Le mot de passe fut incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_&éèàùçμ"#\'{}()[]|^@°+=$¤£*!§:/;.,?²');
|
||||
|
||||
switch (Membre::registerPerson ()) {
|
||||
case 'ok' :
|
||||
$_SESSION ['current_error'] = 'Vous avez déjà été correctement inscrit sur bernard.com';
|
||||
header('Location:login.php');
|
||||
exit();
|
||||
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 {
|
||||
$out = Membre::registerPerson ($_POST ['pseudo'],$_POST ['mdp']);
|
||||
if($out ===Membre::USED_USERNAME)
|
||||
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');
|
||||
|
||||
$_SESSION ['current_error'] = 'Le pseudo sera incorrect : Les seuls caractères autorisés sont :<br/>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
|
||||
}
|
||||
} else {
|
||||
case 'login' :
|
||||
//Action : login
|
||||
if (!( isset ( $_POST ['pseudo'] ) && isset ( $_POST ['mdp'] ) ))
|
||||
exiting('Quand on demande des données, on donne des données !!!');
|
||||
$me = Membre::getFromPseudo($_POST['pseudo']);
|
||||
if(!$me)
|
||||
exiting('Kikètvou ? Pseudo inconnu ...');
|
||||
if(!$me->connect($_POST ['mdp']))
|
||||
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();
|
||||
$_SESSION['session_mdp'] = $_POST['mdp'];
|
||||
exiting('Vous êtes bien connecté (vous l\'avez été et le serez également)!');
|
||||
|
||||
$_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 {
|
||||
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');
|
||||
|
||||
$_SESSION ['current_error'] = 'Quand on demande des données , on donne des données !!!';
|
||||
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
|
||||
try{
|
||||
//$bdd = new PDO('mysql:host=localhost;dbname=bernard.com;charset=utf8', 'root', '');
|
||||
$GLOBALS['bdd'] = new PDO('mysql:host=mysql.hostinger.fr;dbname=u890869027_bcom;charset=utf8', 'u890869027_bcom', '*******************');
|
||||
$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', '*******************');
|
||||
}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>
|
||||
</footer>
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION['current_error'])){
|
||||
?>
|
||||
|
||||
<div class="fullscreen opaque">
|
||||
<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>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$('.fullscreen').on('click',function(){
|
||||
|
||||
@ -1,25 +1,27 @@
|
||||
<?php include_once 'clazz/Zincluder.php'; ?>
|
||||
<header>
|
||||
<!--
|
||||
000000000000000800000000000000000000000000000000000000000000000000000
|
||||
000000000000008000000000000000000000000000000000000000000000000000000
|
||||
000000000000080000000000000888000000000000000000000000000000000000000
|
||||
000000000000800000000000088000880000000000000000000000000000000000000
|
||||
000000000008008000000000000000080000000000000000000000000000000000000
|
||||
000000000080008000000000000000800000000000000000000000000000000000000
|
||||
000000000888888888000000000008000000000000000000000000000000000000000
|
||||
000000000000008000000000000080000000000000000000000000000000000000000
|
||||
000000000000008000000000000800000000000000000000000000000000000000000
|
||||
000000000000008000000000088888880000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000
|
||||
-->
|
||||
|
||||
<!--
|
||||
000000000000000800000000000000000000000000000000000000000000000000000
|
||||
000000000000008000000000000000000000000000000000000000000000000000000
|
||||
000000000000080000000000000888000000000000000000000000000000000000000
|
||||
000000000000800000000000088000880000000000000000000000000000000000000
|
||||
000000000008008000000000000000080000000000000000000000000000000000000
|
||||
000000000080008000000000000000800000000000000000000000000000000000000
|
||||
000000000888888888000000000008000000000000000000000000000000000000000
|
||||
000000000000008000000000000080000000000000000000000000000000000000000
|
||||
000000000000008000000000000800000000000000000000000000000000000000000
|
||||
000000000000008000000000088888880000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000
|
||||
-->
|
||||
|
||||
<?php
|
||||
include_once('includes/inter.php');
|
||||
if(isConnected()){
|
||||
if($me = Membre::me()){
|
||||
?>
|
||||
|
||||
<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">
|
||||
<input type="submit" value="Se déconnecter" />
|
||||
</form>
|
||||
@ -27,7 +29,7 @@
|
||||
|
||||
<?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>
|
||||
<input type="text" name="pseudo" id="pseudo" placeholder="Ex:Bernard" />
|
||||
<label for="mdp">Mot de passe :</label>
|
||||
@ -43,10 +45,10 @@
|
||||
|
||||
<?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">
|
||||
<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="discuts.php">Discussions</a><br class="navV"/>
|
||||
<a href="profile.php">Mon profil</a><br class="navV"/>
|
||||
|
||||
@ -2,8 +2,12 @@
|
||||
include_once 'includes/bdd.php';
|
||||
function isConnected($sid = NULL, $mdp = NULL) {
|
||||
if (! isset ( $sid ) or ! isset ( $mdp )) {
|
||||
if(isset($_SESSION ['session_id']) and isset($_SESSION ['session_mdp'])){
|
||||
$sid = $_SESSION ['session_id'];
|
||||
$mdp = $_SESSION ['session_mdp'];
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
$req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE ID=?' );
|
||||
$req->execute ( array (
|
||||
|
||||
@ -3,9 +3,16 @@
|
||||
<meta name="keywords" lang="fr" content="cercloid officiel, zeidhyx project" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<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">
|
||||
var headBloc = document.getElementsByTagName("head")[0];
|
||||
//Load css according to the browser
|
||||
var link = document.createElement( "link" );
|
||||
link.type = "text/css";
|
||||
link.rel = "stylesheet";
|
||||
@ -15,5 +22,22 @@
|
||||
}else{
|
||||
link.href = "css/noFirefoxStyle.css";
|
||||
}
|
||||
document.getElementsByTagName("head")[0].appendChild( link );
|
||||
headBloc.appendChild( link );
|
||||
|
||||
//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>
|
||||
|
||||
|
||||
125
index.php
125
index.php
@ -11,127 +11,16 @@
|
||||
|
||||
<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">
|
||||
<h2 class="articleTitle"><strong>Cercloïde</strong></h2>
|
||||
<a class="articlePic" href="pictures/cercloid_cacahuete.png"><img src="pictures/cercloid_cacahuete.png" width="128" /></a>
|
||||
<?php foreach(Article::getNewest(10) as $article){ ?>
|
||||
<article>
|
||||
<!-- TODO put class on article node -->
|
||||
<h2 class="articleTitle"><?php echo $article->getTitle(); ?></h2>
|
||||
<?php if($article->getPicPath() != ''){?><a class="articlePic" href="<?php echo $article->getPicPath(); ?>"><img src="<?php echo $article->getPicPath(); ?>" width="128" /></a><?php }?>
|
||||
|
||||
<div class="articleText">
|
||||
$$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>
|
||||
<div class="articleText"><?php echo ($article->getShort() == '')?$article->getText():$article->getShort(); ?></div>
|
||||
</article>
|
||||
<?php } ?>
|
||||
|
||||
<article id="zeidhyxProject">
|
||||
<h2 class="articleTitle"><strong>Zeidhyx Project</strong></h2>
|
||||
<a class="articlePic" href="pictures/into_donut.png"><img src="pictures/into_donut.png" width="128" /></a>
|
||||
|
||||
<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'; ?>
|
||||
</body>
|
||||
|
||||
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>
|
||||
<input type="text" name="pseudo" id="pseudo" placeholder="Ex:Bernard" />
|
||||
<br/>
|
||||
|
||||
23
others.php
23
others.php
@ -1,7 +1,8 @@
|
||||
<?php session_start(); ?>
|
||||
<?php session_start();
|
||||
include_once 'clazz/Zincluder.php';?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<?php include 'includes/meta.php'; ?>
|
||||
</head>
|
||||
@ -12,14 +13,18 @@
|
||||
<h1>Tous les projets</h1>
|
||||
|
||||
<?php
|
||||
include_once 'includes/inter.php';
|
||||
|
||||
$projects = getProjectsWithFirstPermission();
|
||||
|
||||
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/>');
|
||||
$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/>');
|
||||
}
|
||||
?><br/>
|
||||
|
||||
?>
|
||||
<br/>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</body>
|
||||
|
||||
@ -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:
|
||||
23
profile.php
23
profile.php
@ -1,4 +1,5 @@
|
||||
<?php session_start(); ?>
|
||||
<?php session_start();
|
||||
include_once 'clazz/Zincluder.php' ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@ -8,12 +9,15 @@
|
||||
<?php include 'includes/header.php'; ?>
|
||||
|
||||
<?php
|
||||
include_once 'includes/inter.php';
|
||||
|
||||
if(isConnected()){
|
||||
|
||||
$me = Membre::me();
|
||||
if(!$me){
|
||||
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">
|
||||
|
||||
<form method="post" action="executor.php?action=changePassword" 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" />
|
||||
@ -26,14 +30,7 @@
|
||||
<br/>
|
||||
<input type="submit" value="Changer le mot de passe">
|
||||
</form>
|
||||
<?php
|
||||
|
||||
}else{
|
||||
header('Location:register.php');
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</body>
|
||||
</html>
|
||||
135
projet.php
135
projet.php
@ -1,6 +1,7 @@
|
||||
<?php session_start(); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php include_once 'clazz/Zincluder.php';?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<?php include 'includes/meta.php'; ?>
|
||||
@ -9,112 +10,94 @@
|
||||
<body>
|
||||
<?php include 'includes/header.php'; ?>
|
||||
<?php
|
||||
include_once 'includes/inter.php';
|
||||
|
||||
$permissions=array(FALSE,FALSE,FALSE,FALSE);
|
||||
$connected = isConnected();
|
||||
$owner = FALSE;
|
||||
$adminLevel=-1;
|
||||
|
||||
$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;
|
||||
//TODO re la fonction exiting
|
||||
$me = Membre::me();
|
||||
if(!isset($_GET['v'])){
|
||||
header ( 'Location:projets.php');
|
||||
$_SESSION ['current_error'] = 'Quand on demande des données, on donne des données !!!';
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
header('Location:40A.php');
|
||||
goto end;
|
||||
$version = new Version($_GET['v']);
|
||||
if(!$version->exists()){
|
||||
header ( 'Location:projets.php');
|
||||
$_SESSION ['current_error'] = 'Je vais avoir du mal à afficher les donées de la version néant ...';
|
||||
exit;
|
||||
}
|
||||
if($connected)
|
||||
$owner = preg_match('#[^0-9]?' . $_SESSION['session_id'] .'[^0-9]?#',$data ['owners']);
|
||||
$adminLevel = getAdminLevel();
|
||||
if($permissions[0] || $owner){
|
||||
if(count($version->getPublicFiles())<=0 && $me?$me->isAdminLevelLowerThan(12):FALSE && !$version->getProject()->haveRights()){
|
||||
header ( 'Location:projets.php');
|
||||
$_SESSION ['current_error'] = 'Vous n\'avez pas le droit d\'être ici ...<br/> DEGAGEZ !!!';
|
||||
exit;
|
||||
}
|
||||
$su = $me?$version->getProject()->haveRights($me):FALSE OR $me?$me->isAdminLevelHigherThan(12):FALSE;
|
||||
?>
|
||||
|
||||
<h1>Le projet <?php echo($data['name']) ?> en version <?php echo($data['version']) ?></h1>
|
||||
<h1>Le projet <?php echo($version->getProject()->getName()) ?> en version <?php echo($version->getName()) ?></h1>
|
||||
<br/>
|
||||
<?php if($data['language'] == 0){?>
|
||||
<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( "\"#\"");} ?>>
|
||||
<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"/>
|
||||
<?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>
|
||||
<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"/>
|
||||
<?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>
|
||||
<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"/>
|
||||
<?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>
|
||||
<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"/>
|
||||
<?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>
|
||||
<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"/>
|
||||
<?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>
|
||||
|
||||
<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"/>
|
||||
<?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>
|
||||
<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"/>
|
||||
<?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>
|
||||
<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"/>
|
||||
<?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 } ?>
|
||||
|
||||
<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
|
||||
$versions = getVersions($_GET ['id']);
|
||||
?>
|
||||
<?php if(count($versions[0]) > 0){?>
|
||||
<?php foreach($languages as $language){ ?>
|
||||
<table class="versionTable">
|
||||
<tr>
|
||||
<th>Java</th>
|
||||
<th><?php echo $language->getName(); ?></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 }?>
|
||||
<?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 }?>
|
||||
|
||||
<?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){ ?>
|
||||
|
||||
<?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 } ?>
|
||||
<?}else{
|
||||
header('Location:403.php');
|
||||
goto end;
|
||||
}?>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
end:
|
||||
?>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
29
projets.php
29
projets.php
@ -1,7 +1,7 @@
|
||||
<?php session_start(); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<?php session_start();
|
||||
include_once 'clazz/Zincluder.php';?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<?php include 'includes/meta.php'; ?>
|
||||
</head>
|
||||
@ -12,21 +12,24 @@
|
||||
<h1>Mes projets</h1>
|
||||
|
||||
<?php
|
||||
include_once 'includes/inter.php';
|
||||
|
||||
if(isConnected()){
|
||||
|
||||
$projects = getOwnersisProjects();
|
||||
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/>');
|
||||
if($me = Membre::me()){//Defini dans le header.php
|
||||
$projects = Projet::getWhichHeCanAccess($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/>');
|
||||
}
|
||||
|
||||
}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/>
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</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
|
||||
createDiscuts.php
|
||||
sendMessage.php
|
||||
--- Debug ---
|
||||
projet.php : publicy -> authorizedGroup
|
||||
|
||||
--- 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
|
||||
version edit + editing
|
||||
Page admin
|
||||
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