Merged feature/token into dev

This commit is contained in:
xdrm-brackets 2016-04-11 14:27:05 +02:00
commit 3b0a1aaa22
30 changed files with 898 additions and 154 deletions

View File

@ -3,13 +3,10 @@
use \manager\ModuleRequest;
use \manager\ResourceDispatcher;
use \manager\sessionManager;
use \manager\ManagerError;
use \manager\Repo;
use \manager\module\callLog;
debug();
@ -26,7 +23,7 @@
/* [2] On cree la requete
=========================================================*/
$request = new ModuleRequest('callLog/unserialize', array($file_content));
$request = new ModuleRequest('call_log/unserialize', array($file_content));
$answer = $request->dispatch(); // on l'execute
/* [3] Si erreur
@ -70,4 +67,5 @@
parseCallLog();
?>

View File

@ -1,56 +1,17 @@
{
"callLog": [
"call_log": [
"unserialize"
],
"charts": [
"network_data",
"network_render"
],
"userDefault" :[
"create",
"link",
"unlink",
"search",
"getAll",
"getById",
"getByCode",
"getByUsername",
"getClusters",
"edit",
"delete"
],
"machineDefault" :[
"create",
"link",
"unlink",
"search",
"getAll",
"getById",
"getByCode",
"getByName",
"getClusters",
"edit",
"delete"
"token" :[
"remove",
"generate"
]
}

View File

@ -1,6 +1,16 @@
{
"Personnes": [
"getById"
],
"token": [
"getAll",
"getById",
"check",
"generate",
"remove"
]
}

View File

@ -1,2 +1,2 @@
#WRAPPER>#CONTAINER>section{display:none;position:relative;flex-grow:1;padding:1.5em;border-radius:5px;background-color:#fff;color:#000;font-size:1.2em}#WRAPPER>#CONTAINER>section.active{display:block}#WRAPPER>#CONTAINER>section h6{color:#848484;font-size:1.2em;text-transform:uppercase;font-weight:300;letter-spacing:.2em;margin:0;padding:0}#WRAPPER>#CONTAINER>section input[type="radio"],#WRAPPER>#CONTAINER>section input[type="checkbox"]{display:none}#WRAPPER>#CONTAINER>section input[type="radio"]+label[for],#WRAPPER>#CONTAINER>section input[type="checkbox"]+label[for]{padding-left:.8em;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#WRAPPER>#CONTAINER>section input[type="radio"]+label[for]:before,#WRAPPER>#CONTAINER>section input[type="checkbox"]+label[for]:before{content:'';display:inline-block;position:relative;top:.1em;left:-.8em;width:calc( 1em - 2*.15em );height:calc( 1em - 2*.15em );border-radius:50% / 50%;border:0.15em solid #53d192;background:#fff center center no-repeat;background-image:none;background-size:70% auto;transition:background .2s ease-in-out;cursor:pointer}#WRAPPER>#CONTAINER>section input[type="radio"]:checked+label[for]:before,#WRAPPER>#CONTAINER>section input[type="checkbox"]:checked+label[for]:before{background-color:#53d192;background-image:url("/f/svg/checked/st/container")}#WRAPPER>#CONTAINER>section input[type="checkbox"]+label[for]:before{border-radius:3px}#WRAPPER>#CONTAINER>section input[type="button"]{margin:.5em;padding:.5em;border-radius:5px;border:3px solid #515151;font-weight:bold;color:#515151;background-color:#fff;transition:background .1s ease-in-out, color .1s ease-in-out}#WRAPPER>#CONTAINER>section input[type="button"]:active{background-color:#515151;color:#fff}#WRAPPER>#CONTAINER>section input[type="button"].primary{border-color:#53d192;color:#53d192;background-color:#fff}#WRAPPER>#CONTAINER>section input[type="button"].primary:active{background-color:#53d192;color:#fff}
#WRAPPER>#CONTAINER>section{display:none;position:relative;flex-grow:1;padding:1em;border-radius:3px;background-color:#fff;color:#000;font-size:1em}#WRAPPER>#CONTAINER>section.active{display:block}#WRAPPER>#CONTAINER>section h6{color:#848484;font-size:1.2em;text-transform:uppercase;font-weight:300;letter-spacing:.2em;margin:0;padding:0}#WRAPPER>#CONTAINER>section h6:before{content:'- '}#WRAPPER>#CONTAINER>section h6:after{content:' -'}#WRAPPER>#CONTAINER>section h6.center{text-align:center}#WRAPPER>#CONTAINER>section input[type="radio"],#WRAPPER>#CONTAINER>section input[type="checkbox"]{display:none}#WRAPPER>#CONTAINER>section input[type="radio"]+label[for],#WRAPPER>#CONTAINER>section input[type="checkbox"]+label[for]{padding-left:.8em;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#WRAPPER>#CONTAINER>section input[type="radio"]+label[for]:before,#WRAPPER>#CONTAINER>section input[type="checkbox"]+label[for]:before{content:'';display:inline-block;position:relative;top:.1em;left:-.8em;width:calc( 1em - 2*.15em );height:calc( 1em - 2*.15em );border-radius:50% / 50%;border:0.15em solid #53d192;background:#fff center center no-repeat;background-image:none;background-size:70% auto;transition:background .2s ease-in-out;cursor:pointer}#WRAPPER>#CONTAINER>section input[type="radio"]:checked+label[for]:before,#WRAPPER>#CONTAINER>section input[type="checkbox"]:checked+label[for]:before{background-color:#53d192;background-image:url("/f/svg/checked/st/container")}#WRAPPER>#CONTAINER>section input[type="checkbox"]+label[for]:before{border-radius:3px}#WRAPPER>#CONTAINER>section input[type="button"]{margin:.5em 0;padding:.3em .5em;border-radius:3px;border:1px solid #515151;font-weight:bold;color:#515151;background-color:#fff;transition:background .1s ease-in-out, color .1s ease-in-out}#WRAPPER>#CONTAINER>section input[type="button"]:hover{background-color:#515151;color:#fff}#WRAPPER>#CONTAINER>section input[type="button"].primary{border-color:#53d192;color:#53d192;background-color:#fff}#WRAPPER>#CONTAINER>section input[type="button"].primary:hover{background-color:#53d192;color:#fff}
/*# sourceMappingURL=container.css.map */

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAMC,2BAAW,CACV,OAAO,CAAE,IAAI,CAKb,QAAQ,CAAE,QAAQ,CAClB,SAAS,CAAE,CAAC,CAEZ,OAAO,CAAE,KAAK,CAEd,aAAa,CAAE,GAAG,CAElB,gBAAgB,CAAE,IAAI,CAEtB,KAAK,CAAE,IAAI,CACX,SAAS,CAAE,KAAK,CAZhB,kCAAQ,CAAC,OAAO,CAAE,KAAK,CAkBvB,8BAAI,CACH,KAAK,CAAE,OAAsB,CAC7B,SAAS,CAAE,KAAK,CAChB,cAAc,CAAE,SAAS,CACzB,WAAW,CAAE,GAAG,CAChB,cAAc,CAAE,IAAI,CAEpB,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CAYX,kGACwB,CACvB,OAAO,CAAE,IAAI,CA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,SAAS,CAElB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,iBAAmB,CAE3B,WAAW,CAAE,IAAI,CACjB,KAAK,CCrHW,OAAO,CDuHvB,gBAAgB,CAAE,IAAI,CAEtB,UAAU,CAAE,iDAAiD,CAG7D,sDAAO,CACN,gBAAgB,CC7HD,OAAO,CD8HtB,KAAK,CAAE,IAAI,CAKZ,wDAAS,CACR,YAAY,CCnIG,OAAO,CDoItB,KAAK,CCpIU,OAAO,CDqItB,gBAAgB,CAAE,IAAI,CAItB,8DAAO,CACN,gBAAgB,CC1IF,OAAO,CD2IrB,KAAK,CAAE,IAAI",
"sources": ["container.scss","constants.scss"],
"names": [],
"file": "container.css"

View File

@ -13,14 +13,14 @@
position: relative;
flex-grow: 1;
padding: 1.5em;
padding: 1em;
border-radius: 5px;
border-radius: 3px;
background-color: #fff;
color: #000;
font-size: 1.2em;
font-size: 1em;
@ -36,8 +36,13 @@
margin: 0;
padding: 0;
// &:before{content:'- ';}
// &:after{content:' -';}
&:before{content:'- ';}
&:after{content:' -';}
// quand centré
&.center{
text-align: center;
}
}
@ -108,11 +113,11 @@
/* [5] Boutons de submit
=========================================================*/
& input[type="button"]{
margin: .5em;
padding: .5em;
margin: .5em 0;
padding: .3em .5em;
border-radius: 5px;
border: 3px solid $theme-fg;
border-radius: 3px;
border: 1px solid $theme-fg;
font-weight: bold;
color: $theme-fg;
@ -121,8 +126,8 @@
transition: background .1s ease-in-out, color .1s ease-in-out;
/* (1) Animation de @active */
&:active{
/* (1) Animation de @hover */
&:hover{
background-color: $theme-fg;
color: #fff;
}
@ -135,8 +140,8 @@
background-color: #fff;
/* (3) Animation de @active pour bouton primaire */
&:active{
/* (3) Animation de @hover pour bouton primaire */
&:hover{
background-color: $theme-fg-primary;
color: #fff;
}

View File

@ -1,2 +1,2 @@
section[data-panel-list]{display:block;position:relative;border-radius:3px;border:1px solid #ccc;background-color:#fff;font-size:.8em}section[data-panel-list]>div[data-header]{display:flex;position:relative;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;padding:.5em .7em;border-radius:3px 3px 0 0;border-bottom:1px solid #ccc;background-color:#f5f5f5;box-shadow:inset 0 0 5px #eee}section[data-panel-list]>div[data-header]>span,section[data-panel-list]>div[data-header]>button{color:#333;font-weight:bold;line-height:2em}section[data-panel-list]>div[data-header]>button{padding:.1em .7em;border-radius:3px;border:1px solid #555;background:#f5f5f5;transition:all .2s ease-in-out}section[data-panel-list]>div[data-header]>button:hover{background:#333;color:#fff}section[data-panel-list]>div[data-description]{display:block;position:relative;border-bottom:1px solid #ccc;padding:.7em .7em;color:#666}section[data-panel-list]>ul[data-list]{display:flex;position:relative;flex-direction:column;justify-content:flex-start;flex-wrap:nowrap;margin:0;padding:0;list-style:none}section[data-panel-list]>ul[data-list]>li[data-element]{display:flex;flex-direction:row;justify-content:space-between;align-items:center;flex-wrap:nowrap;padding:1em}section[data-panel-list]>ul[data-list]>li[data-element]:not(:last-child){border-bottom:1px solid #ccc}section[data-panel-list]>ul[data-list]>li[data-element]>div:nth-child(1){display:flex;width:10em;height:6em;flex-direction:column;justify-content:flex-end;align-items:center;background:url("/f/svg/token/st/container/666666") center 1em no-repeat;background-size:auto 50%}section[data-panel-list]>ul[data-list]>li[data-element]>div:nth-child(1).active{background-image:url("/f/svg/token/st/container/4cbf86")}section[data-panel-list]>ul[data-list]>li[data-element]>div:nth-child(1)>span{display:block;padding:0 .4em;border-radius:3px;border:1px solid #ddd;font-size:.8em;color:#666;text-transform:uppercase;font-weight:bold}section[data-panel-list]>ul[data-list]>li[data-element]>div:nth-child(n+2){display:flex;position:relative;flex:10em;padding:1em;flex-direction:column;justify-content:flex-start;align-items:flex-start;font-size:.9em;color:#666;font-weight:bold}section[data-panel-list]>ul[data-list]>li[data-element]>div:nth-child(n+2)>span[data-prefix]:before{content:attr(data-prefix) ": ";font-weight:normal}section[data-panel-list]>ul[data-list]>li[data-element]>button{padding:.1em .7em;height:2em;border-radius:3px;border:1px solid #de2b08;background:#fff;color:#de2b08;font-weight:bold;transition:all .2s ease-in-out}section[data-panel-list]>ul[data-list]>li[data-element]>button:hover{background:#de2b08;color:#fff}section[data-panel-list]>div[data-add]{display:none;position:relative;padding:1em;border-bottom:1px solid #ccc;background-color:#f5f5f5;font-weight:bold}section[data-panel-list]>div[data-add].active{display:block}section[data-panel-list]>div[data-add]>input[type='text']{margin:1em 0;padding:.3em .5em;border-radius:3px;border:1px solid #999;background-color:#fff;color:#000;font-weight:normal}
/*# sourceMappingURL=global.css.map */

View File

@ -1,7 +1,7 @@
{
"version": 3,
"mappings": "",
"sources": [],
"mappings": "AAEA,wBAAwB,CACvB,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAElB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,cAAc,CAEtB,gBAAgB,CAAE,IAAI,CAEtB,SAAS,CAAE,IAAI,CAIf,yCAAoB,CACnB,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAGlB,cAAc,CAAE,GAAG,CACnB,SAAS,CAAE,MAAM,CACjB,eAAe,CAAE,aAAa,CAC9B,WAAW,CAAE,MAAM,CAEnB,OAAO,CAAE,SAAS,CAElB,aAAa,CAAE,WAAW,CAC1B,aAAa,CAAE,cAAc,CAE7B,gBAAgB,CAAE,OAAO,CACzB,UAAU,CAAE,kBAAkB,CAG9B,+FACU,CACT,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,IAAI,CACjB,WAAW,CAAE,GAAG,CAIjB,gDAAU,CACT,OAAO,CAAE,SAAS,CAElB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,cAAc,CAEtB,UAAU,CAAE,OAAO,CAEnB,UAAU,CAAE,mBAAmB,CAG/B,sDAAO,CACN,UAAU,CAAE,IAAI,CAChB,KAAK,CAAE,IAAI,CAQd,8CAAyB,CACxB,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAElB,aAAa,CAAE,cAAc,CAE7B,OAAO,CAAE,SAAS,C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B,8DAAU,CACT,OAAO,CAAE,SAAS,CACjB,MAAM,CAAE,GAAG,CAEZ,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,iBAAiB,CAEzB,UAAU,CAAE,IAAI,CAEhB,KAAK,CAAE,OAAO,CACd,WAAW,CAAE,IAAI,CAEjB,UAAU,CAAE,mBAAmB,CAG/B,oEAAO,CACN,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI,CASf,sCAAiB,CAChB,OAAO,CAAE,IAAI,CAOb,QAAQ,CAAE,QAAQ,CAElB,OAAO,CAAE,GAAG,CAEZ,aAAa,CAAE,cAAc,CAE7B,gBAAgB,CAAE,OAAO,CAEzB,WAAW,CAAE,IAAI,CAZjB,6CAAQ,CACP,OAAO,CAAE,KAAK,CAef,yDAAsB,CACrB,MAAM,CAAE,KAAK,CACb,OAAO,CAAE,SAAS,CAElB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,cAAc,CAEtB,gBAAgB,CAAE,IAAI,CAEtB,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,MAAM",
"sources": ["global.scss"],
"names": [],
"file": "global.css"
}

View File

@ -0,0 +1,233 @@
/* [1] Panneau d'ajout/suppression d'elements
=========================================================*/
section[data-panel-list]{
display: block;
position: relative;
border-radius: 3px;
border: 1px solid #ccc;
background-color: #fff;
font-size: .8em;
/* (1) Header (titre + ajout) */
& > div[data-header]{
display: flex;
position: relative;
// flex properties
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
padding: .5em .7em;
border-radius: 3px 3px 0 0;
border-bottom: 1px solid #ccc;
background-color: #f5f5f5;
box-shadow: inset 0 0 5px #eee;
// Libelle du panel
& > span,
& > button{
color: #333;
font-weight: bold;
line-height: 2em;
}
// Bouton ajouter
& > button{
padding: .1em .7em;
border-radius: 3px;
border: 1px solid #555;
background: #f5f5f5;
transition: all .2s ease-in-out;
// Animation de @hover
&:hover{
background: #333;
color: #fff;
}
}
}
/* (2) Description (sous le header) */
& > div[data-description]{
display: block;
position: relative;
border-bottom: 1px solid #ccc;
padding: .7em .7em;
color: #666;
}
/* (3) Liste des elements */
& > ul[data-list]{
display: flex;
position: relative;
// flex properties
flex-direction: column;
justify-content: flex-start;
flex-wrap: nowrap;
margin: 0;
padding: 0;
list-style: none;
/* (4) Chaque element de la liste */
& > li[data-element]{
display: flex;
// flex properties
flex-direction: row;
justify-content: space-between;
align-items: center;
flex-wrap: nowrap;
padding: 1em;
// rebord en bas sauf dernier
&:not(:last-child){
border-bottom: 1px solid #ccc;
}
/* (4.1) Logo et type d'element */
& > div:nth-child(1){
display: flex;
width: 10em;
height: 6em;
// flex properties
flex-direction: column;
justify-content: flex-end;
align-items: center;
background: url('/f/svg/token/st/container/666666') center 1em no-repeat;
background-size: auto 50%;
// Si le token est actif
&.active{
background-image: url('/f/svg/token/st/container/4cbf86');
}
// Texte pour le type d'element
& > span{
display: block;
padding: 0 .4em;
border-radius: 3px;
border: 1px solid #ddd;
font-size: .8em;
color: #666;
text-transform: uppercase;
font-weight: bold;
}
}
/* (4.2) Donnees descriptives */
& > div:nth-child(n+2){
display: flex;
position: relative;
flex: 10em;
padding: 1em;
// flex properties
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
font-size: .9em;
color: #666;
font-weight: bold;
// On prefixe chaque donnee
& > span[data-prefix]:before{
content: attr(data-prefix) ": ";
font-weight: normal;
}
}
/* (4.3) Bouton de suppression */
& > button{
padding: .1em .7em;
height: 2em;
border-radius: 3px;
border: 1px solid #de2b08;
background: #fff;
color: #de2b08;
font-weight: bold;
transition: all .2s ease-in-out;
// Animation de @hover
&:hover{
background: #de2b08;
color: #fff;
}
}
}
}
/* (5) Formulaire d'ajout d'un nouvel element */
& > div[data-add]{
display: none;
// Affichage quand .active
&.active{
display: block;
}
position: relative;
padding: 1em;
border-bottom: 1px solid #ccc;
background-color: #f5f5f5;
font-weight: bold;
/* (5.1) Champs de texte */
& > input[type='text']{
margin: 1em 0;
padding: .3em .5em;
border-radius: 3px;
border: 1px solid #999;
background-color: #fff;
color: #000;
font-weight: normal;
}
}
}

View File

@ -1,2 +1,2 @@
#WRAPPER{display:block;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#e8e8e8;font-family:'Open Sans'}#WRAPPER>#HEADER{display:flex;position:absolute;top:0;left:15em;width:calc( 100% - 15em );height:calc( 5em - 1px );border-bottom:1px solid #e5e5e5;background-color:#fff;flex-direction:row;justify-content:flex-end;align-content:space-around;z-index:10}#WRAPPER>#MENU-SIDE{display:block;position:absolute;top:0;left:0;width:15em;height:100%;box-shadow:2px 1px 3px #ddd;background-color:#32323a;transition:all .3s;z-index:9}#WRAPPER>#CONTAINER{display:flex;position:absolute;top:5em;left:15em;width:calc( 100% - 15em - 2*1em );height:calc( 100% - 15em - 2*1em );padding:1em;flex-direction:row;justify-content:space-between;overflow-x:none;overflow-y:auto}
#WRAPPER{display:block;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#e8e8e8;font-family:'Open Sans';font-size:15px;overflow-x:hidden;overflow-y:auto}#WRAPPER>#HEADER{display:flex;position:absolute;top:0;left:15em;width:calc( 100% - 15em );height:calc( 5em - 1px );border-bottom:1px solid #e5e5e5;background-color:#fff;flex-direction:row;justify-content:flex-end;align-content:space-around;z-index:10}#WRAPPER>#MENU-SIDE{display:block;position:fixed;top:0;left:0;width:15em;height:100%;box-shadow:2px 1px 3px #ddd;background-color:#32323a;transition:all .3s;z-index:9}#WRAPPER>#CONTAINER{display:flex;position:absolute;top:5em;left:15em;width:calc( 100% - 15em - 2*1em );min-height:calc( 100% - 5em - 2*1em );padding:1em;flex-direction:row;justify-content:space-between;overflow-x:none;overflow-y:auto}
/*# sourceMappingURL=layout.css.map */

View File

@ -1,6 +1,6 @@
{
"version": 3,
"mappings": "AAEA,QAAQ,CACP,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,KAAK,CACd,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE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W,CACV,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CACjB,GAAG,CAAE,CAAC,CACN,IAAI,CCPW,IAAI,CDQnB,KAAK,CAAE,mBAAkC,CACzC,MAAM,CAAE,iBAA+B,CAExC,aAAa,CAAE,iBAA8B,CAE7C,gBAAgB,CC3BC,IAAO,CD8BxB,cAAc,CAAE,GAAG,CACnB,eAAe,CAAE,QAAQ,CACzB,aAAa,CAAE,YAAY,CAE3B,OAAO,CAAE,EAAE,CAQZ,mBAAc,CACb,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,KAAK,CACd,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CCjCU,IAAI,CDkCnB,MAAM,CAAE,IAAI,CAEb,UAAU,CAAE,gBAAgB,CAE5B,gBAAgB,CC/CA,OAAO,CDiDvB,UAAU,CAAE,OAAO,CAEnB,OAAO,CAAE,CAAC,CAMX,mBAAc,CACb,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CACjB,GAAG,CClDY,GAAG,CDmDlB,IAAI,CCpDW,IAAI,CDqDnB,KAAK,CAAE,2BAA0C,CACjD,UAAU,CAAE,0BAAwC,CACrD,OAAO,CAAE,GAAG,CAGZ,cAAc,CAAE,GAAG,CACnB,eAAe,CAAE,aAAa,CAE9B,UAAU,CAAE,IAAI,CAChB,UAAU,CAAE,IAAI",
"sources": ["layout.scss","constants.scss"],
"names": [],
"file": "layout.css"

View File

@ -11,6 +11,10 @@
background-color: $theme-bg;
font-family: 'Open Sans';
font-size: 15px;
overflow-x: hidden;
overflow-y: auto;
/* [1] Header de la page
@ -42,7 +46,7 @@
// Gestion du menu
& > #MENU-SIDE{
display: block;
position: absolute;
position: fixed;
top: 0;
left: 0;
width: $menu-side-width;
@ -66,7 +70,7 @@
top: $header-height;
left: $menu-side-width;
width: calc( 100% - #{$menu-side-width} - 2*1em );
height: calc( 100% - #{$menu-side-width} - 2*1em );
min-height: calc( 100% - #{$header-height} - 2*1em );
padding: 1em;
// Flex properties

View File

@ -197,4 +197,9 @@
/* [6] Gestion du rechargement de page
=========================================================*/
function reload(){ navMenu( pageManager.page ); }
// }

View File

@ -10,6 +10,7 @@ APIClass.prototype = {
*
* @param pRequest<Object> l'objet passé en JSON à http://host/api/
* @param pHandler<Function> fonction qui s'éxécutera lors de la réponse (1 argument -> réponse<Object>)
* @param pToken<String> si donne, token d'auth pour l'api
*
* @return answer<Object> l'objet retourné par http://host/api/ via pHandler (1er argument)
*
@ -26,7 +27,7 @@ APIClass.prototype = {
* 3. on passe une fonction qui utilise un argument (sera la réponse de http://host/api/) (sous forme d'objet)
*
*/
send: function(pRequest, pHandler){
send: function(pRequest, pHandler, pToken){
// Si le chemin de delegation n'est pas renseigne, on renvoie une erreur
if( !pRequest.hasOwnProperty('path') )
@ -77,7 +78,16 @@ APIClass.prototype = {
if( pRequest.hasOwnProperty('data') )
form.append('data', JSON.stringify(pRequest.data) );
this.xhr[i].open('POST', this.target, true);
// Gestion du token optionnel
if( pToken != null ) this.xhr[i].setRequestHeader('Authorization', 'Digest '+pToken);
this.xhr[i].send( form );
}

View File

@ -191,10 +191,18 @@
return $checker && is_numeric($value) && $value <= 2147483647 && $value >= -2147483647;
break;
case 'int':
return $checker && is_numeric($value) && $value <= 2147483647 && $value >= 0;
break;
case 'varchar(255)':
return $checker && is_string($value) && strlen($value) <= 255;
break;
case 'varchar(50)':
return $checker && is_string($value) && strlen($value) <= 50;
break;
/* (2) Utilisateur */
case 'user.code':
case 'machine.code':
@ -216,7 +224,7 @@
return $checker && is_string($value) && strlen($value) <= 50 && preg_match('/^[\w\.-]+@[\w\.-]+\.[a-z]{2,4}$/i', $value);
break;
case 'user.password':
case 'sha1':
return $checker && is_string($value) && preg_match('/^[\da-f]{40}$/i', $value);
break;
@ -231,5 +239,42 @@
}
////////////////////////////////////
// _ _
// __| | __ _| |_ ___ ___
// / _` |/ _` | __/ _ \/ __|
// | (_| | (_| | || __/\__ \
// \__,_|\__,_|\__\___||___/
//
////////////////////////////////////
// 1) Convertis une date en en francais explicite
public static function frDate($date){
/* [1] On definit les traductions
=========================================================*/
// Jours de la semaine
$days = array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche");
// Mois de l'annee
$months = array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
/* [2] On recupere le timestamp et les indices
=========================================================*/
$time = strtotime($date); // timestamp
$daynum = intval( date('N', $time)-1 ); // jour dans la semaine
$monthnum = intval( date('n', $time)-1 ); // numero du mois dans l'annee
/* [3] On recupere les infos independemment
=========================================================*/
$result = array(
$days[$daynum], // nom de jour
date('j', $time), // jour du mois
$months[$monthnum], // nom du mois
date('Y', $time), // annee
);
return implode(" ", $result);
}
}
?>

View File

@ -60,6 +60,10 @@
// Erreur lors de la creation d'un objet PDO (connection)
const PDOConnection = 14;
/* API token */
// Token inexistant ou faux
const TokenError = 15;
/* EXPLICITE UN CODE D'ERREUR
*
@ -90,6 +94,8 @@
case self::PDOConnection: return "La connexion avec la base de donnees a echoue"; break;
case self::TokenError: return "Le token de connection est absent ou errone"; break;
// default: return "Erreur inconnue..."; break;
}

View File

@ -137,7 +137,7 @@
public function serialize(){
// On rajoute l'erreur au message
$returnData = array_merge( array('ModuleError' => $this->error), $this->data );
$returnData = array_merge( array('ModuleError' => $this->error, 'ErrorDescription' => ManagerError::explicit($this->error)), $this->data );
return json_encode($returnData);

View File

@ -167,6 +167,25 @@
*
*/
public static function fromPost($post){
/* [0] Verification de l'authentification
=========================================================*/
/* (1) Si le token n'est pas dans le header */
if( !isset($_SERVER['PHP_AUTH_DIGEST']) ){
$tmp = new ModuleRequest();
$tmp->error = ManagerError::TokenError;
return $tmp;
}
/* (2) Si le token n'est pas dans la BDD */
$checkToken = new Repo('token/check', array($_SERVER['PHP_AUTH_DIGEST']) );
$valid_token = $checkToken->answer();
if( !$valid_token ){
$tmp = new ModuleRequest();
$tmp->error = ManagerError::TokenError;
return $tmp;
}
/* [1] On verifie que le @path est renseigne
=========================================================*/
if( !isset($post['path']) )

View File

@ -1,6 +1,8 @@
<?php
namespace manager;
use \manager\Repo;
use \manager\sessionManager;
class ResourceDispatcher{
@ -245,10 +247,21 @@
header('Content-Type: '.$this->header);
// On recupere le contenu
$svg_content = file_get_contents($this->path);
$content = file_get_contents($this->path);
////////////////////////////////////////
///////////// SI FICHIER JS ////////////
////////////////////////////////////////
if( $this->flags['extension'] == 'js' )
$content = 'var js_access_token = "'. substr($_SESSION['session_token'], 0, 40) .'";' . "\n\n" . $content;
// On affiche tout
echo str_replace( '</svg>', $this->stylesheet.'</svg>', $svg_content );
echo str_replace( '</svg>', $this->stylesheet.'</svg>', $content );
}
@ -263,10 +276,10 @@
// On inclut le contenu
$svg_content = file_get_contents($this->path);
$content = file_get_contents($this->path);
// On retourne tout
return str_replace( '</svg>', $this->stylesheet.'</svg>', $svg_content );
return str_replace( '</svg>', $this->stylesheet.'</svg>', $content );
}

View File

@ -6,7 +6,7 @@
use \manager\ManagerError;
use \manager\Repo;
class callLog{
class call_log{
/* DESERIALISATION D'UN JOURNAL D'APPEL

0
manager/module/charts.php Normal file → Executable file
View File

92
manager/module/token.php Executable file
View File

@ -0,0 +1,92 @@
<?php
namespace manager\module;
use \manager\Database;
use \manager\sessionManager;
use \manager\ManagerError;
use \manager\Repo;
class token{
/* SUPPRIME UN TOKEN D'ID DONNE
*
* @id_token<int> UID du token en question
*
* @return status<bool> Retourne l'etat de la suppression (VRAI -> fait/FAUX -> erreur)
*
*/
public static function remove($id_token){
/* [0] Verification des INPUT
=========================================================*/
if( !Database::check('id', $id_token) ) return array('ModuleError' => ManagerError::ParamError);
/* [1] Suppression du token
=========================================================*/
$remove = new Repo('token/remove', array($id_token));
// On renvoie une erreur si une erreur intervient pendant la suppression
if( !$remove->answer() ) return array('ModuleError' => ManagerError::ModuleError);
/* [n] Gestion du retour quand tout est normal
=========================================================*/
return array( 'ModuleError' => ManagerError::Success );
}
/* GENERE UN NOUVEAU TOKEN DE NOM ET EXPIRATION SPECIFIEE
*
* @name<String> Nom attribue au token
* @duration<int> Duree du token en jours
*
* @return id_token<int> Renvoie l'id du token cree
* @return FALSE Renvoie FALSE si erreur
*
*/
public static function generate($name, $duration){
/* [0] Verification des INPUT
=========================================================*/
if( !Database::check('varchar(50)', $name) || !Database::check('numeric', $duration) )
return array('ModuleError' => ManagerError::ParamError); // erreur de parametre
/* [1] On cree le token et recupere son id ou FAUX
=========================================================*/
$create = new Repo('token/generate', array($name, $duration));
$created = $create->answer();
// Si erreur de creation
if( $created === false ) return array('ModuleError' => ManagerError::ModuleError );
/* [2] Gestion du retour
=========================================================*/
return array(
'ModuleError' => ManagerError::Success,
'id_token' => $created
);
}
}
?>

View File

@ -1,65 +0,0 @@
<?php
namespace manager\repo;
use \manager\Database;
class Token{
/* Gestion de la table Token (pour secu) et des derivations
*
* 1. Gestion de la verification
* - check(token, id_personne)
*
* 3. Gestion de la
* - merge(idA, idB)
*
* 4. Gestion de creation
* - create(pseudo, nom, prenom, facebook, telephone)
*
*
*/
/* RENVOIE LES DONNEES D'UN UTILISATEUR D'UID DONNE
*
* @id_personne<int> UID de la personne en question
*
* @return personne<Array> Tableau associatif contenant les informations utiles de la personne
* @return FALSE<boolean> Si une erreur occure ou qu'aucune personne n'est trouvee, retourne FALSE
*
*/
public static function getById($id_personne=null){
/* [0] Verification des INPUT
=========================================================*/
if( !Database::check('id', $id_personne) ) return false;
/* [1] On prepare et execute la requete
=========================================================*/
$request = Database::getPDO()->prepare("SELECT idPersonne as id, pseudo, nom, prenom, id_facebook, telephone
FROM Personnes
WHERE idPersonne = :uid");
$request->execute(array(
':uid' => $id_personne
));
/* [2] On recupere le resultat
=========================================================*/
// si aucun resultat, on retourne FALSE
if( ($personne=$request->fetch()) === false ) return false;
/* [3] On retourne les donnees
=========================================================*/
return Database::delNumeric( $personne, true );
}
}
?>

212
manager/repo/token.php Normal file
View File

@ -0,0 +1,212 @@
<?php
namespace manager\repo;
use \manager\sessionManager;
use \manager\Database;
class token{
/* Gestion de la table Token (pour secu) et des derivations
*
* 1. Gestion des access
* - getAll()
* - getById(id_token)
*
* 2. Gestion de la verification
* - check(token, id_personne)
*
* 4. Gestion de creation
* - generate(name, duration)
*
* 4. Gestion de creation
* - create(pseudo, nom, prenom, facebook, telephone)
*
*
*/
/* RETOURNE LA LISTE DE TOUS LES TOKENS
*
* @return tokens<Array> Liste de tous les tokens
*
*/
public static function getAll(){
/* [1] On prepare et execute la requete
=========================================================*/
$request = Database::getPDO()->query("SELECT id_token as id, name, token, expires, (CURDATE() > expires) as expired
FROM api_token
ORDER BY expires DESC");
/* [3] On retourne les donnees
=========================================================*/
return Database::delNumeric( $request->fetchAll() );
}
/* RETOURNE LE TOKEN D'ID SPECIFIE OU FALSE
*
* @id_token<int> UID du token en question
*
* @return token<Array> Retourne les donnees du token ou FALSE si erreur
*
*/
public static function getById($id_token){
/* [0] Verification des INPUT
=========================================================*/
if( !Database::check('id', $id_token) ) return false;
/* [1] On cherche dans la bdd
=========================================================*/
$get_token = Database::getPDO()->prepare("SELECT id_token FROM api_token WHERE id_token = :id_token");
$get_token->execute( array( ':id_token' => $id_token ) );
/* [2] On renvoie la valeur ou FALSE
=========================================================*/
return $get_token->fetch();
}
/* VERIFIE SI UN TOKEN EST VALIDE
*
* @token<String> Token en question
*
* @return valid<bool> Retourne si VRAI ou FAUX le token est valid
*
*/
public static function check($token){
/* [0] Verification des INPUT
=========================================================*/
// si le format est incorrect, on retourne FAUX
if( !Database::check('sha1', $token) ) return false;
/* [1] Verification du token local
=========================================================*/
if( substr($_SESSION['session_token'], 0, 40) == $token ) return true;
/* [2] Verification dans la base de donnees
=========================================================*/
$check = Database::getPDO()->prepare("SELECT id_token
FROM api_token
WHERE CURDATE() <= expires
AND token = :token");
$check->execute(array( ':token' => $token ));
/* [3] On retourne le resultat
=========================================================*/
return $check->fetch() !== false;
}
/* GENERE UN NOUVEAU TOKEN DE NOM ET EXPIRATION SPECIFIEE
*
* @name<String> Nom attribue au token
* @duration<int> Duree du token en jours
*
* @return id_token<int> Renvoie l'id du token cree
* @return FALSE Renvoie FALSE si erreur
*
*/
public static function generate($name, $duration){
/* [0] Verification des INPUT
=========================================================*/
if( !Database::check('varchar(50)', $name) || !Database::check('int', $duration) ) return false;
// On definit la date d'expiration du token
$expiration = date('Y-m-d', time()+$duration*3600*24);
/* [1] Generation d'un token si pas deja dans la BDD
=========================================================*/
$token_used = true;
// tant qu'un token a deja la meme valeur
while( $token_used ){
$token = sessionManager::secure_sha1(uniqid());
// Verification dans la BDD
$check = Database::getPDO()->prepare("SELECT id_token FROM api_token WHERE token = :token");
$check->execute( array( ':token' => $token ) );
// VRAI un token est identique
$token_used = $check->fetch() !== false;
}
/* [2] On cree le token
=========================================================*/
$create = Database::getPDO()->prepare("INSERT INTO api_token(id_token, token, name, expires)
VALUES(DEFAULT, :token, :name, :expiration)");
$create->execute(array(
':token' => $token,
':name' => $name,
':expiration' => $expiration
));
/* [3] On verifie qu'il a bien ete cree
=========================================================*/
$created = Database::getPDO()->prepare("SELECT id_token FROM api_token
WHERE token = :token
AND name = :name");
$created->execute(array(
':token' => $token,
':name' => $name
));
$created_data = $created->fetch();
// Si pas cree, on retourne une erreur
if( $created_data === false ) return false;
/* [4] On retourne l'id du token cree
=========================================================*/
return $created_data['id_token'];
}
/* SUPPRIME UN TOKEN D'ID SPECIFIE
*
* @id_token<int> UID du token en question
*
* @return status<bool> VRAI si le token est bien cree sinon FALSE
*
*/
public static function remove($id_token){
/* [0] Verification des INPUT
=========================================================*/
if( !Database::check('id', $id_token) ) return false;
/* [1] On verifie l'existance du token
=========================================================*/
if( !self::getById($id_token) ) return false;
/* [2] Suppression du token
=========================================================*/
$remove = Database::getPDO()->prepare("DELETE FROM api_token
WHERE id_token = :id_token");
$remove->execute(array( ':id_token' => $id_token ));
/* [3] On retourne VRAI si le token est bien supprime
=========================================================*/
return self::getById($id_token) === false;
}
}
?>

View File

@ -20,6 +20,7 @@
/* INITIALISATION DE SESSION */
/*****************************/
private static function reset_session($session_id=null){
// On ferme la session
session_destroy();
@ -36,7 +37,6 @@
// On met a jour le token
self::update_token();
header('Refresh: 0');
}
@ -86,16 +86,14 @@
self::reset_session( $sessid ); // On initialise la session (bon id session)
// si id session invalide
/* [3] Verification du token
==============================================================*/
// On verifie que le token est valide
$valid_token = $session_token != null; // verification de l'existence du cookie
$valid_token = $valid_token && strpos($session_token, self::$prefix) === 0; // verification des donnes personnelles
$valid_token = $valid_token && isset($_SESSION['session_token']); // verification que la variable session associee existe
$valid_token = $valid_token && $_SESSION['session_token'] == $_COOKIE['session_token']; // verification que la session est coherente
$valid_token = $session_token != null; // verification de l'existence du cookie
$valid_token = $valid_token && strpos($session_token, self::$prefix) === 0; // verification des donnes personnelles
$valid_token = $valid_token && isset($_SESSION['session_token']); // verification que la variable session associee existe
$valid_token = $valid_token && $_SESSION['session_token'] == $_COOKIE['session_token']; // verification que la session est coherente
/* [4] Si token inexistant
==============================================================*/

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
enable-background="new 0 0 139 139"
height="32"
id="Safety"
version="1.1"
viewBox="0 0 32.000001 32"
width="32"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="token.svg"><metadata
id="metadata4207"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs4205" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1056"
id="namedview4203"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:snap-page="true"
inkscape:zoom="13.726619"
inkscape:cx="26.74026"
inkscape:cy="15.083197"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="Safety" /><path
d="m 27.259844,13.87868 c 0.118671,-0.67971 0.184135,-1.37892 0.184135,-2.09374 C 27.443979,5.286998 22.310196,0 16.000007,0 9.6895395,0 4.5554775,5.286998 4.5554775,11.78494 c 0,0.71482 0.06574,1.41347 0.184693,2.09374 -0.993663,0.63459 -1.654433,1.74413 -1.654433,3.01135 l 0,11.53702 c 0,1.9734 1.599833,3.57295 3.572672,3.57295 l 18.6829165,0 c 1.972282,0 3.571836,-1.59955 3.571836,-3.57295 l 0.0011,0 0,-11.53702 c 0,-1.26694 -0.660213,-2.37676 -1.654432,-3.01135 z m -9.683404,10.07368 0,2.50714 c 0,0.87137 -0.705899,1.57727 -1.57699,1.57727 -0.871092,0 -1.57699,-0.7059 -1.57699,-1.57727 l 0,-2.50825 c -1.011491,-0.55742 -1.697612,-1.63298 -1.697612,-2.86984 0,-1.80848 1.466119,-3.27488 3.275159,-3.27488 1.809039,0 3.275437,1.4664 3.275437,3.27488 0,1.23741 -0.686678,2.31381 -1.699004,2.87095 z m 5.513198,-10.63556 -14.1795395,0 c -0.09722,-0.49446 -0.149035,-1.00731 -0.149035,-1.53186 0,-4.1794 3.2473015,-7.579355 7.2389445,-7.579355 3.991363,0 7.238386,3.399675 7.238386,7.579355 0,0.52455 -0.05126,1.0374 -0.148756,1.53186 z"
id="stylisable"
inkscape:connector-curvature="0" /></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -61,14 +61,20 @@
<span class='icon sep' ><?= ResourceDispatcher::getResource('f/svg/icon/st' ); ?>CALL LOG</span>
<span data-link='dashboard' ><?= ResourceDispatcher::getResource('f/svg/home/st/menu-side'); ?>Tableau de bord</span>
<div class='sub'>
<span data-sublink='presentation'>Presentation</span>
</div>
<span data-link='input' ><?= ResourceDispatcher::getResource('f/svg/input/st/menu-side'); ?>Acquisition</span>
<div class='sub'>
<span data-sublink='q'>Questionnaire</span>
<span data-sublink='fb'>Facebook</span>
<span data-sublink='tel'>Journal d'appel</span>
<span data-sublink='tel'>Journal telephonique</span>
</div>
<span data-link='analytics' ><?= ResourceDispatcher::getResource('f/svg/analytics/st/menu-side'); ?>Statistiques</span>
<span data-link='charts' class='sep'><?= ResourceDispatcher::getResource('f/svg/charts/st/menu-side'); ?>Visualisation</span>
<span data-link='settings' ><?= ResourceDispatcher::getResource('f/svg/settings/st/menu-side' ); ?>Paramètres</span>
<div class='sub'>
<span data-sublink='tokens'>Gestion des tokens</span>

View File

@ -19,7 +19,7 @@
<section>
<section data-sublink='presentation'>
<h6>sexe</h6>
<input type='radio' name='sexe' value='0' id='sexeM'><label for='sexeM'>Homme</label><br>
<input type='radio' name='sexe' value='1' id='sexeF'><label for='sexeF'>Femme</label><br>

84
view/js/settings.js Normal file
View File

@ -0,0 +1,84 @@
/* [1] Gestion des tokens
=========================================================*/
var TOKEN = {
add: { // Tout ce qui attrait a l'ajout
toggle: document.getElementById('add-token'), // bouton de toggle pour l'affichage du panel
panel: document.querySelector('div[data-add]'), // formulaire de creation
state: true, // etat (visible ou non) du panel
name: document.getElementById('add-name'), // nom du token a creer
duration: document.getElementById('add-duration'), // duree du token a creer (en jours)
submit: document.getElementById('add-submit') // validation de la creation
},
remove: {
buttons: document.querySelectorAll('.remove-token')
}
};
/* (1) Gestion de la creation de token */
/* (1.1) Gestion du toggle pour le panel de creation */
TOKEN.add.toggle.addEventListener('click', function(e){
TOKEN.add.panel.className = (TOKEN.add.state) ? 'active' : ''; // toggle de la classe (visibilite)
TOKEN.add.state = !TOKEN.add.state; // switch de l'etat pour le toggle
}, false);
/* (1.2) Gestion de la creation */
TOKEN.add.submit.addEventListener('click', function(e){
// On redige la requete
var request = { // on ecrit la requete
'path': 'token/generate',
'data': [TOKEN.add.name.value, TOKEN.add.duration.value]
};
// On lance la requete
api.send(request, function(answer){
console.log(answer);
// Si la generation effectuee, on recharge la page
if( answer.ModuleError == 0 )
reload();
}, js_access_token);
}, false);
/* (2) Gestion de la suppression de token */
for( var i = 0 ; i < TOKEN.remove.buttons.length ; i++ ){
/* (2.0) Pour chaque bouton supprimer, on attache un evenement */
TOKEN.remove.buttons[i].addEventListener('click', function(e){
var token_id = e.target.parentNode.getData('id');
/* (2.1) Si on ne trouve pas l'id, on retourne une erreur */
if( token_id == false ){ console.warn('id du token non trouvee'); return; }
/* (2.2) On lance la suppression */
var request = { // on ecrit la requete
'path': 'token/remove',
'data': [token_id]
};
// On lance la requete
api.send(request, function(answer){
// Si la suppression effectuee, on recharge la page
if( answer.ModuleError == 0 )
reload();
}, js_access_token);
}, false);
}

View File

@ -1,13 +1,72 @@
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
require_once __ROOT__.'/manager/autoloader.php';
use \manager\Repo;
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\ResourceDispatcher;
use \manager\Database;
/* [1] On recupere les tokens
=========================================================*/
$req_tokens = new Repo('token/getAll');
$tokens = $req_tokens->answer();
?>
<section data-sublink='tokens' class='active'>
Gestion des tokens
<section data-sublink='tokens'>
<h6 class='center'>Gestion des TOKENS</h6><br>
<!-- [1] Panel d'ajout/suppression de token -->
<section data-panel-list>
<!-- Header -->
<div data-header>
<span>Gestion des accès distants</span>
<button id='add-token'>Ajouter un accès</button>
</div>
<!-- Description des tokens actifs -->
<div data-description>Liste des accès distants actifs. Ils seront automatiquement désactivés a la date d'expiration. Veuillez toutefois les supprimer.</div>
<!-- Creation d'un nouvel element (cache) -->
<div data-add>
<label for='add-name'>Nom de l'accès</label><br><input type='text' placeholder='token' id='add-name'><br>
<label for='add-duration'>Duree de vie (jours)</label><br><input type='text' value='10' id='add-duration'><br>
<input type='button' value='Ajouter un accès' id='add-submit'>
</div>
<!-- Conteneur de la liste des elements -->
<ul data-list>
<!-- Elements de la liste -->
<?php
foreach($tokens as $token){
echo "<li data-element data-id='".$token['id']."'>";
// Si token actif
if( !$token['expired'] )
echo "<div class='active'><span>actif</span></div>";
else
echo "<div><span>Expiré</span></div>";
echo "<div>";
echo "<span>".$token['name']."</span>";
echo "<span data-prefix='Expiration'>".Database::frDate($token['expires'])."</span>";
echo "<span data-prefix='Token'>".$token['token']."</span>";
echo "</div>";
echo "<button class='remove-token'>Supprimer</button>";
echo "</li>";
}
?>
</ul>
</section>
</section>
<section data-sublink='users'>