From dd38a4790c1db2336eed4081e94a775175ed3d09 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 10 Apr 2016 15:33:36 +0200 Subject: [PATCH 01/14] =?UTF-8?q?Interface=20pour=20la=20gestion=20des=20t?= =?UTF-8?q?okens=20(acces=20=C3=A0=20l'API)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/container.css | 2 +- css/container.css.map | 2 +- css/container.scss | 4 +- css/global.css | 2 +- css/global.css.map | 4 +- css/global.scss | 189 +++++++++++++++++++++++++++++++++ css/layout.css | 2 +- css/layout.css.map | 2 +- css/layout.scss | 1 + src/static/container/token.svg | 49 +++++++++ view.php | 2 +- view/settings.php | 44 +++++++- 12 files changed, 292 insertions(+), 11 deletions(-) create mode 100644 src/static/container/token.svg diff --git a/css/container.css b/css/container.css index afefeeb..87d10ed 100755 --- a/css/container.css +++ b/css/container.css @@ -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: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} /*# sourceMappingURL=container.css.map */ diff --git a/css/container.css.map b/css/container.css.map index 2288800..7f3ca94 100755 --- a/css/container.css.map +++ b/css/container.css.map @@ -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,CAId,wHACqC,CACpC,YAAY,CAAE,IAAI,CAGlB,qBAAqB,CAAE,IAAI,CAC3B,mBAAmB,CAAI,IAAI,CAC3B,kBAAkB,CAAK,IAAI,CAC3B,gBAAgB,CAAO,IAAI,CAC3B,eAAe,CAAQ,IAAI,CAC3B,WAAW,CAAY,IAAI,CAI3B,sIAA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AAI,CAItB,+DAAQ,CACP,gBAAgB,CCrIF,OAAO,CDsIrB,KAAK,CAAE,IAAI", "sources": ["container.scss","constants.scss"], "names": [], "file": "container.css" diff --git a/css/container.scss b/css/container.scss index c306593..caafc32 100755 --- a/css/container.scss +++ b/css/container.scss @@ -13,9 +13,9 @@ position: relative; flex-grow: 1; - padding: 1.5em; + padding: 1em; - border-radius: 5px; + border-radius: 3px; background-color: #fff; diff --git a/css/global.css b/css/global.css index fb5e5ad..2d03fd5 100755 --- a/css/global.css +++ b/css/global.css @@ -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 #ddd;background:linear-gradient(#fcfcfc, #eee)}section[data-panel-list]>div[data-header]>button:hover{background:linear-gradient(#fcfcfc, #ddd)}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)>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{border-color:#de2b08;background:#de2b08;color:#fff} /*# sourceMappingURL=global.css.map */ diff --git a/css/global.css.map b/css/global.css.map index 48ce0fa..e619c5f 100755 --- a/css/global.css.map +++ b/css/global.css.map @@ -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,SAA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tB,eAAe,CAAE,UAAU,CAC3B,WAAW,CAAE,UAAU,CAEvB,SAAS,CAAE,IAAI,CACf,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,IAAI,CAGjB,mGAA4B,CAC3B,OAAO,CAAE,sBAAsB,CAC/B,WAAW,CAAE,MAAM,CAKrB,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,YAAY,CAAE,OAAO,CACrB,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,IAAI", +"sources": ["global.scss"], "names": [], "file": "global.css" } \ No newline at end of file diff --git a/css/global.scss b/css/global.scss index e69de29..defa5c1 100755 --- a/css/global.scss +++ b/css/global.scss @@ -0,0 +1,189 @@ +/* [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 #ddd; + + background: linear-gradient(#fcfcfc, #eee); + + // Animation de @hover + &:hover{ + background: linear-gradient(#fcfcfc, #ddd); + } + } + + } + + + /* (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%; + + // 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{ + border-color: #de2b08; + background: #de2b08; + color: #fff; + } + } + + } + } + +} \ No newline at end of file diff --git a/css/layout.css b/css/layout.css index 36f2bbc..f4da49d 100755 --- a/css/layout.css +++ b/css/layout.css @@ -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}#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} /*# sourceMappingURL=layout.css.map */ diff --git a/css/layout.css.map b/css/layout.css.map index e554b26..e40d3c5 100755 --- a/css/layout.css.map +++ b/css/layout.css.map @@ -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,IAAI,CAEb,gBAAgB,CCPE,OAAO,CDSzB,WAAW,CAAE,WAAW,CAKxB,gBAAW,CACV,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CACjB,GAAG,CAAE,CAAC,CACN,IAAI,CCHW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BxB,cAAc,CAAE,GAAG,CACnB,eAAe,CAAE,QAAQ,CACzB,aAAa,CAAE,YAAY,CAE3B,OAAO,CAAE,EAAE,CAQZ,mBAAc,CACb,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CACjB,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CC9BU,IAAI,CD+BnB,MAAM,CAAE,IAAI,CAEb,UAAU,CAAE,gBAAgB,CAE5B,gBAAgB,CC5CA,OAAO,CD8CvB,UAAU,CAAE,OAAO,CAEnB,OAAO,CAAE,CAAC,CAMX,mBAAc,CACb,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CACjB,GAAG,CC/CY,GAAG,CDgDlB,IAAI,CCjDW,IAAI,CDkDnB,KAAK,CAAE,2BAA0C,CACjD,MAAM,CAAE,2BAA0C,CACnD,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" diff --git a/css/layout.scss b/css/layout.scss index ae58152..5bd237a 100755 --- a/css/layout.scss +++ b/css/layout.scss @@ -11,6 +11,7 @@ background-color: $theme-bg; font-family: 'Open Sans'; + font-size: 15px; /* [1] Header de la page diff --git a/src/static/container/token.svg b/src/static/container/token.svg new file mode 100644 index 0000000..5866d52 --- /dev/null +++ b/src/static/container/token.svg @@ -0,0 +1,49 @@ + +image/svg+xml \ No newline at end of file diff --git a/view.php b/view.php index a21f538..d590f31 100755 --- a/view.php +++ b/view.php @@ -65,7 +65,7 @@
Questionnaire Facebook - Journal d'appel + Journal telephonique
Statistiques Visualisation diff --git a/view/settings.php b/view/settings.php index 4a377cc..504d5a2 100755 --- a/view/settings.php +++ b/view/settings.php @@ -7,7 +7,49 @@
- Gestion des tokens + +
Gestion des TOKENS

+ + +
+ +
+ Gestion des accès distants + +
+ + +
Liste des accès distants actifs. Ils seront automatiquement désactivés a la date d'expiration.
+ + +
    + + +
  • +
    token
    +
    + name + date de création + date d'expiration + 90:31:ec:16:02:99:90:df:72:5f:02:f1:ad:d5:76:c7 +
    + +
  • + + +
  • +
    token
    +
    + name + date de création + date d'expiration + 90:31:ec:16:02:99:90:df:72:5f:02:f1:ad:d5:76:c7 +
    + +
  • + +
+
From 1e224f3719123571772eba261a0b0d2759f323ac Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 10 Apr 2016 15:38:56 +0200 Subject: [PATCH 02/14] Refactor => flat-design Refonte mineure du design vers du flat-design --- css/global.css | 2 +- css/global.css.map | 2 +- css/global.scss | 12 +++++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/css/global.css b/css/global.css index 2d03fd5..441e787 100755 --- a/css/global.css +++ b/css/global.css @@ -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 #ddd;background:linear-gradient(#fcfcfc, #eee)}section[data-panel-list]>div[data-header]>button:hover{background:linear-gradient(#fcfcfc, #ddd)}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)>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{border-color:#de2b08;background:#de2b08;color:#fff} +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:.2em 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)>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} /*# sourceMappingURL=global.css.map */ diff --git a/css/global.css.map b/css/global.css.map index e619c5f..958e33a 100755 --- a/css/global.css.map +++ b/css/global.css.map @@ -1,6 +1,6 @@ { "version": 3, -"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,MAA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Ac,CAAE,SAAS,CACzB,WAAW,CAAE,IAAI,CAMnB,0EAAsB,CACrB,OAAO,CAAE,IAAI,CACb,QAAQ,CAAE,QAAQ,CAElB,IAAI,CAAE,IAAI,CAEV,OAAO,CAAE,GAAG,CAGZ,cAAc,CAAE,MAAM,CACtB,eAAe,CAAE,UAAU,CAC3B,WAAW,CAAE,UAAU,CAEvB,SAAS,CAAE,IAAI,CACf,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,IAAI,CAGjB,mGAA4B,CAC3B,OAAO,CAAE,sBAAsB,CAC/B,WAAW,CAAE,MAAM,CAKrB,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", "sources": ["global.scss"], "names": [], "file": "global.css" diff --git a/css/global.scss b/css/global.scss index defa5c1..f29fca2 100755 --- a/css/global.scss +++ b/css/global.scss @@ -44,13 +44,16 @@ section[data-panel-list]{ padding: .1em .7em; border-radius: 3px; - border: 1px solid #ddd; + border: 1px solid #555; - background: linear-gradient(#fcfcfc, #eee); + background: #f5f5f5; + + transition: all .2s ease-in-out; // Animation de @hover &:hover{ - background: linear-gradient(#fcfcfc, #ddd); + background: #333; + color: #fff; } } @@ -97,7 +100,7 @@ section[data-panel-list]{ align-items: center; flex-wrap: nowrap; - padding: 1em; + padding: .2em 1em; // rebord en bas sauf dernier &:not(:last-child){ @@ -177,7 +180,6 @@ section[data-panel-list]{ // Animation de @hover &:hover{ - border-color: #de2b08; background: #de2b08; color: #fff; } From 8aba0f373f63d85a5f3ac1593c2bf1455baffbd9 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 10 Apr 2016 16:40:49 +0200 Subject: [PATCH 03/14] Gestion de l'affichage des tokens (BDD/Repo) --- config/repositories.json | 5 ++++ manager/repo/Token.php | 65 ---------------------------------------- manager/repo/token.php | 51 +++++++++++++++++++++++++++++++ view/settings.php | 46 ++++++++++++++-------------- 4 files changed, 80 insertions(+), 87 deletions(-) delete mode 100644 manager/repo/Token.php create mode 100644 manager/repo/token.php diff --git a/config/repositories.json b/config/repositories.json index 64d94f5..808b331 100755 --- a/config/repositories.json +++ b/config/repositories.json @@ -1,6 +1,11 @@ { "Personnes": [ "getById" + ], + + + "token": [ + "getAll" ] } \ No newline at end of file diff --git a/manager/repo/Token.php b/manager/repo/Token.php deleted file mode 100644 index f305209..0000000 --- a/manager/repo/Token.php +++ /dev/null @@ -1,65 +0,0 @@ - UID de la personne en question - * - * @return personne Tableau associatif contenant les informations utiles de la personne - * @return FALSE 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 ); - } - - - - - - - } - - -?> \ No newline at end of file diff --git a/manager/repo/token.php b/manager/repo/token.php new file mode 100644 index 0000000..9f15e9e --- /dev/null +++ b/manager/repo/token.php @@ -0,0 +1,51 @@ + 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, creation, expires + FROM api_token + ORDER BY creation ASC"); + + /* [2] On recupere et retourne les donnees + =========================================================*/ + return Database::delNumeric( $request->fetchAll() ); + } + + + + + + } + + +?> \ No newline at end of file diff --git a/view/settings.php b/view/settings.php index 504d5a2..88ed07a 100755 --- a/view/settings.php +++ b/view/settings.php @@ -1,8 +1,17 @@ answer(); + ?> @@ -24,29 +33,22 @@
    - -
  • -
    token
    -
    - name - date de création - date d'expiration - 90:31:ec:16:02:99:90:df:72:5f:02:f1:ad:d5:76:c7 -
    - -
  • + + "; + echo "
    token
    "; + echo "
    "; + echo "".$token['name'].""; + echo "date de création"; + echo "date d'expiration"; + echo "90:31:ec:16:02:99:90:df:72:5f:02:f1:ad:d5:76:c7"; + echo "
    "; + echo ""; + echo ""; + } + ?> - -
  • -
    token
    -
    - name - date de création - date d'expiration - 90:31:ec:16:02:99:90:df:72:5f:02:f1:ad:d5:76:c7 -
    - -
From 4b92b19d92f287854d2ac1987651201367db7d82 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 10 Apr 2016 17:01:44 +0200 Subject: [PATCH 04/14] Correction de l'affichage --- manager/Database.php | 37 +++++++++++++++++++++++++++++++++++++ manager/repo/token.php | 1 + view/settings.php | 7 ++++--- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/manager/Database.php b/manager/Database.php index 0892cfb..76017b2 100755 --- a/manager/Database.php +++ b/manager/Database.php @@ -231,5 +231,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); + } + } ?> diff --git a/manager/repo/token.php b/manager/repo/token.php index 9f15e9e..a1ea427 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -34,6 +34,7 @@ =========================================================*/ $request = Database::getPDO()->query("SELECT id_token as id, name, token, creation, expires FROM api_token + WHERE CURDATE() BETWEEN creation AND expires ORDER BY creation ASC"); /* [2] On recupere et retourne les donnees diff --git a/view/settings.php b/view/settings.php index 88ed07a..6bae503 100755 --- a/view/settings.php +++ b/view/settings.php @@ -4,6 +4,7 @@ use \manager\ModuleRequest; use \manager\ManagerError; use \manager\ResourceDispatcher; + use \manager\Database; @@ -40,9 +41,9 @@ $tokens = $req_tokens->answer(); echo "
token
"; echo "
"; echo "".$token['name'].""; - echo "date de création"; - echo "date d'expiration"; - echo "90:31:ec:16:02:99:90:df:72:5f:02:f1:ad:d5:76:c7"; + echo "".Database::frDate($token['creation']).""; + echo "".Database::frDate($token['expires']).""; + echo "".$token['token'].""; echo "
"; echo ""; echo ""; From 4950f66fd92889e68de7c31faace0afc6635bf2b Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 10 Apr 2016 17:40:09 +0200 Subject: [PATCH 05/14] =?UTF-8?q?Gestion=20de=20l'acc=C3=A8s=20=C3=A0=20l'?= =?UTF-8?q?API=20avec=20tokens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- automate.php | 2 -- config/repositories.json | 3 ++- manager/Database.php | 2 +- manager/ManagerError.php | 6 ++++++ manager/ModuleAnswer.php | 2 +- manager/ModuleRequest.php | 19 +++++++++++++++++++ manager/repo/token.php | 31 +++++++++++++++++++++++++++++++ 7 files changed, 60 insertions(+), 5 deletions(-) diff --git a/automate.php b/automate.php index 6e7cf89..141e480 100755 --- a/automate.php +++ b/automate.php @@ -68,6 +68,4 @@ var_dump( $contact ); } - parseCallLog(); - ?> \ No newline at end of file diff --git a/config/repositories.json b/config/repositories.json index 808b331..bd2feb1 100755 --- a/config/repositories.json +++ b/config/repositories.json @@ -5,7 +5,8 @@ "token": [ - "getAll" + "getAll", + "check" ] } \ No newline at end of file diff --git a/manager/Database.php b/manager/Database.php index 76017b2..dfe3052 100755 --- a/manager/Database.php +++ b/manager/Database.php @@ -216,7 +216,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; diff --git a/manager/ManagerError.php b/manager/ManagerError.php index f26f8f6..83c6547 100755 --- a/manager/ManagerError.php +++ b/manager/ManagerError.php @@ -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; } diff --git a/manager/ModuleAnswer.php b/manager/ModuleAnswer.php index 808a4b3..e3d5fc1 100755 --- a/manager/ModuleAnswer.php +++ b/manager/ModuleAnswer.php @@ -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' => ManagerError::explicit($this->error)), $this->data ); return json_encode($returnData); diff --git a/manager/ModuleRequest.php b/manager/ModuleRequest.php index cc7dab3..5171a5e 100755 --- a/manager/ModuleRequest.php +++ b/manager/ModuleRequest.php @@ -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']) ) diff --git a/manager/repo/token.php b/manager/repo/token.php index a1ea427..3da7517 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -45,6 +45,37 @@ + /* VERIFIE SI UN TOKEN EST VALIDE + * + * @token Token en question + * + * @return valid 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 dans la base de donnees + =========================================================*/ + $check = Database::getPDO()->prepare("SELECT id_token + FROM api_token + WHERE CURDATE() BETWEEN creation AND expires + AND token = :token"); + $check->execute(array( ':token' => $token )); + + + /* [2] On retourne le resultat + =========================================================*/ + return $check->fetch() !== false; + } + + + + } From dca56c624764716e75392eef81d8cf68b56d1643 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 10 Apr 2016 18:27:38 +0200 Subject: [PATCH 06/14] Ajout du panneau d'ajout d'un token --- automate.php | 2 ++ css/container.css | 2 +- css/container.css.map | 2 +- css/container.scss | 27 ++++++++++++++++----------- css/global.css | 2 +- css/global.css.map | 2 +- css/global.scss | 36 ++++++++++++++++++++++++++++++++++++ view.php | 6 ++++++ view/dashboard.php | 2 +- view/js/settings.js | 19 +++++++++++++++++++ view/settings.php | 16 ++++++++++++---- 11 files changed, 96 insertions(+), 20 deletions(-) create mode 100644 view/js/settings.js diff --git a/automate.php b/automate.php index 141e480..6e7cf89 100755 --- a/automate.php +++ b/automate.php @@ -68,4 +68,6 @@ var_dump( $contact ); } + parseCallLog(); + ?> \ No newline at end of file diff --git a/css/container.css b/css/container.css index 87d10ed..fe5fcfe 100755 --- a/css/container.css +++ b/css/container.css @@ -1,2 +1,2 @@ -#WRAPPER>#CONTAINER>section{display:none;position:relative;flex-grow:1;padding:1em;border-radius:3px;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 */ diff --git a/css/container.css.map b/css/container.css.map index 7f3ca94..f0e7180 100755 --- a/css/container.css.map +++ b/css/container.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAMC,2BAAW,CACV,OAAO,CAAE,IAAI,CAKb,QAAQ,CAAE,QAAQ,CAClB,SAAS,CAAE,CAAC,CAEZ,OAAO,CAAE,GAAG,CAEZ,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,CAId,wHACqC,CACpC,YAAY,CAAE,IAAI,CAGlB,qBAAqB,CAAE,IAAI,CAC3B,mBAAmB,CAAI,IAAI,CAC3B,kBAAkB,CAAK,IAAI,CAC3B,gBAAgB,CAAO,IAAI,CAC3B,eAAe,CAAQ,IAAI,CAC3B,WAAW,CAAY,IAAI,CAI3B,sIAAQ,CACP,OAAO,CAAE,EAAE,CACX,OAAO,CAAE,YAAY,CACrB,QAAQ,CAAE,QAAQ,CACjB,GAAG,CAAE,IAAI,CACT,IAAI,CAAE,KAAK,CACX,KAAK,CAAE,qBAAqB,CAC5B,MAAM,CAAE,qBAAqB,CAE9B,aAAa,CAAE,SAAS,CACxB,MAAM,CAAE,oBAA6B,CAErC,UAAU,CAAE,4BAA4B,CACxC,gBAAgB,CAAE,IAAI,CACtB,eAAe,CAAE,QAAQ,C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AY,CAAE,IAAI,CAGlB,qBAAqB,CAAE,IAAI,CAC3B,mBAAmB,CAAI,IAAI,CAC3B,kBAAkB,CAAK,IAAI,CAC3B,gBAAgB,CAAO,IAAI,CAC3B,eAAe,CAAQ,IAAI,CAC3B,WAAW,CAAY,IAAI,CAI3B,sIAAQ,CACP,OAAO,CAAE,EAAE,CACX,OAAO,CAAE,YAAY,CACrB,QAAQ,CAAE,QAAQ,CACjB,GAAG,CAAE,IAAI,CACT,IAAI,CAAE,KAAK,CACX,KAAK,CAAE,qBAAqB,CAC5B,MAAM,CAAE,qBAAqB,CAE9B,aAAa,CAAE,SAAS,CACxB,MAAM,CAAE,oBAA6B,CAErC,UAAU,CAAE,4BAA4B,CACxC,gBAAgB,CAAE,IAAI,CACtB,eAAe,CAAE,QAAQ,CAEzB,UAAU,CAAE,0BAA0B,CAEtC,MAAM,CAAE,OAAO,CAKjB,sJACoD,CACnD,gBAAgB,CC5FA,OAAO,CD6FvB,gBAAgB,CAAE,kCAAkC,CAKrD,oEAA4C,CAC3C,aAAa,CAAE,GAAG,CASnB,gDAAsB,CACrB,MAAM,CAAE,MAAM,CACd,OAAO,CAAE,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" diff --git a/css/container.scss b/css/container.scss index caafc32..a895999 100755 --- a/css/container.scss +++ b/css/container.scss @@ -20,7 +20,7 @@ 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; } diff --git a/css/global.css b/css/global.css index 441e787..0c2524a 100755 --- a/css/global.css +++ b/css/global.css @@ -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:.2em 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)>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]{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:.2em 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)>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-top: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 */ diff --git a/css/global.css.map b/css/global.css.map index 958e33a..be31f82 100755 --- a/css/global.css.map +++ b/css/global.css.map @@ -1,6 +1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B,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" diff --git a/css/global.scss b/css/global.scss index f29fca2..8289c27 100755 --- a/css/global.scss +++ b/css/global.scss @@ -188,4 +188,40 @@ section[data-panel-list]{ } } + + /* (5) Formulaire d'ajout d'un nouvel element */ + & > div[data-add]{ + display: none; + + // Affichage quand .active + &.active{ + display: block; + } + + position: relative; + + padding: 1em; + + border-top: 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; + } + } + } \ No newline at end of file diff --git a/view.php b/view.php index d590f31..fb0edf6 100755 --- a/view.php +++ b/view.php @@ -61,14 +61,20 @@ CALL LOG Tableau de bord +
+ Presentation +
+ Acquisition
Questionnaire Facebook Journal telephonique
+ Statistiques Visualisation + Paramètres
Gestion des tokens diff --git a/view/dashboard.php b/view/dashboard.php index 85b3edd..4c0ae7f 100755 --- a/view/dashboard.php +++ b/view/dashboard.php @@ -19,7 +19,7 @@ -
+
sexe


diff --git a/view/js/settings.js b/view/js/settings.js new file mode 100644 index 0000000..ef41127 --- /dev/null +++ b/view/js/settings.js @@ -0,0 +1,19 @@ +/* [1] Gestion des tokens +=========================================================*/ + +/* (1) Gestion de la creation de token */ +var add_token_button = document.getElementById('add-token'); +var add_panel = document.querySelector('div[data-add]'); + +/* (1.1) Gestion du toggle pour le panel de creation */ +var add_panel_state = true; +add_token_button.addEventListener('click', function(e){ + + add_panel.className = (add_panel_state) ? 'active' : ''; + + add_panel_state = !add_panel_state; +}, false); + + +/* (n) Gestion de la suppression de token */ +var remove_token_buttons = document.querySelectorAll('.remove-token'); \ No newline at end of file diff --git a/view/settings.php b/view/settings.php index 6bae503..4ee2ced 100755 --- a/view/settings.php +++ b/view/settings.php @@ -16,16 +16,16 @@ $tokens = $req_tokens->answer(); ?> -
+
-
Gestion des TOKENS

+
Gestion des TOKENS

Gestion des accès distants - +
@@ -45,13 +45,21 @@ $tokens = $req_tokens->answer(); echo "".Database::frDate($token['expires']).""; echo "".$token['token'].""; echo "
"; - echo ""; + echo ""; echo ""; } ?> + + + +
+

+

+ +
From 50ad82eb90c583e5830740c4866fde1eb8fdb617 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 10 Apr 2016 18:50:07 +0200 Subject: [PATCH 07/14] =?UTF-8?q?Modifications=20graphique=20+=20prise=20e?= =?UTF-8?q?n=20compte=20de=20l'=C3=A9tat=20actif/expir=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/global.css | 2 +- css/global.css.map | 2 +- css/global.scss | 6 ++++++ manager/repo/token.php | 20 ++++++++++++++------ view/settings.php | 14 ++++++++++---- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/css/global.css b/css/global.css index 0c2524a..382a60b 100755 --- a/css/global.css +++ b/css/global.css @@ -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:.2em 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)>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-top: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} +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:.2em 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-top: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 */ diff --git a/css/global.css.map b/css/global.css.map index be31f82..da4bf12 100755 --- a/css/global.css.map +++ b/css/global.css.map @@ -1,6 +1,6 @@ { "version": 3, -"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,CAElB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,CAEV,OAAO,CAAE,GAAG,CAGZ,cAAc,CAAE,MAAM,CACtB,eAAe,CAAE,UAAU,CAC3B,WAAW,CAAE,UAAU,CAEvB,SAAS,CAAE,IAAI,CACf,KAAK,CAAE,IAAI,CACX,WAAW,CAAE,IAAI,CAGjB,mGAA4B,CAC3B,OAAO,CAAE,sBAAsB,CAC/B,WAAW,CAAE,MAAM,CAKrB,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,UAAU,CAAE,cAAc,CAE1B,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" diff --git a/css/global.scss b/css/global.scss index 8289c27..3fe94b3 100755 --- a/css/global.scss +++ b/css/global.scss @@ -121,6 +121,12 @@ section[data-panel-list]{ 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; diff --git a/manager/repo/token.php b/manager/repo/token.php index 3da7517..c127448 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -32,14 +32,22 @@ public static function getAll(){ /* [1] On prepare et execute la requete =========================================================*/ - $request = Database::getPDO()->query("SELECT id_token as id, name, token, creation, expires + $request = Database::getPDO()->query("SELECT id_token as id, name, token, expires FROM api_token - WHERE CURDATE() BETWEEN creation AND expires - ORDER BY creation ASC"); + ORDER BY expires DESC"); - /* [2] On recupere et retourne les donnees + /* [2] On recupere les donnees et ajout le status d'expire ou non =========================================================*/ - return Database::delNumeric( $request->fetchAll() ); + $data = Database::delNumeric( $request->fetchAll() ); + + // Si le token est expire + foreach($data as $i=>$token) + $data[$i]['expired'] = time() > strtotime($token['expires']); + + + /* [3] On retourne le resultat + =========================================================*/ + return $data; } @@ -63,7 +71,7 @@ =========================================================*/ $check = Database::getPDO()->prepare("SELECT id_token FROM api_token - WHERE CURDATE() BETWEEN creation AND expires + WHERE CURDATE() < expires AND token = :token"); $check->execute(array( ':token' => $token )); diff --git a/view/settings.php b/view/settings.php index 4ee2ced..57338f0 100755 --- a/view/settings.php +++ b/view/settings.php @@ -28,7 +28,7 @@ $tokens = $req_tokens->answer(); - +
Liste des accès distants actifs. Ils seront automatiquement désactivés a la date d'expiration.
@@ -38,13 +38,19 @@ $tokens = $req_tokens->answer(); "; - echo "
token
"; + // Si token actif + if( !$token['expired'] ) + echo "
actif
"; + else + echo "
Expiré
"; + + echo "
"; echo "".$token['name'].""; - echo "".Database::frDate($token['creation']).""; echo "".Database::frDate($token['expires']).""; echo "".$token['token'].""; echo "
"; + echo ""; echo ""; } @@ -57,7 +63,7 @@ $tokens = $req_tokens->answer();


-

+

From dba4975ce0de7b07bfd492a08504ae99593c7654 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 11 Apr 2016 10:18:10 +0200 Subject: [PATCH 08/14] Gestion de suppression et generation (repo+modules) + correction graphique du container --- automate.php | 15 ++- config/modules.json | 47 +------- config/repositories.json | 4 +- css/layout.css | 2 +- css/layout.css.map | 2 +- css/layout.scss | 7 +- manager/Database.php | 8 ++ manager/module/{callLog.php => call_log.php} | 2 +- manager/module/charts.php | 0 manager/module/token.php | 109 +++++++++++++++++++ manager/repo/token.php | 95 +++++++++++++++- 11 files changed, 233 insertions(+), 58 deletions(-) rename manager/module/{callLog.php => call_log.php} (99%) mode change 100644 => 100755 manager/module/charts.php create mode 100755 manager/module/token.php diff --git a/automate.php b/automate.php index 6e7cf89..6c1eadf 100755 --- a/automate.php +++ b/automate.php @@ -6,10 +6,6 @@ use \manager\ManagerError; use \manager\Repo; - use \manager\module\callLog; - - debug(); - @@ -26,7 +22,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 @@ -68,6 +64,13 @@ var_dump( $contact ); } - parseCallLog(); + // parseCallLog(); + + + $request = new ModuleRequest('token/generate', array('newtoken', '2') ); + $answer = $request->dispatch(); + + var_dump( ManagerError::explicit($request->error) ); + var_dump( $answer ); ?> \ No newline at end of file diff --git a/config/modules.json b/config/modules.json index 5a23a2d..79a9639 100755 --- a/config/modules.json +++ b/config/modules.json @@ -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" ] } \ No newline at end of file diff --git a/config/repositories.json b/config/repositories.json index bd2feb1..24fd6f7 100755 --- a/config/repositories.json +++ b/config/repositories.json @@ -6,7 +6,9 @@ "token": [ "getAll", - "check" + "getById", + "check", + "generate" ] } \ No newline at end of file diff --git a/css/layout.css b/css/layout.css index f4da49d..8840469 100755 --- a/css/layout.css +++ b/css/layout.css @@ -1,2 +1,2 @@ -#WRAPPER{display:block;position:fixed;top:0;left:0;width:100%;height:100%;background-color:#e8e8e8;font-family:'Open Sans';font-size:15px}#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 */ diff --git a/css/layout.css.map b/css/layout.css.map index e40d3c5..a0f5c89 100755 --- a/css/layout.css.map +++ b/css/layout.css.map @@ -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,C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AU,CAAE,MAAM,CAClB,UAAU,CAAE,IAAI,CAKhB,gBAAW,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" diff --git a/css/layout.scss b/css/layout.scss index 5bd237a..11cdfa4 100755 --- a/css/layout.scss +++ b/css/layout.scss @@ -13,6 +13,9 @@ font-family: 'Open Sans'; font-size: 15px; + overflow-x: hidden; + overflow-y: auto; + /* [1] Header de la page ==========================================*/ @@ -43,7 +46,7 @@ // Gestion du menu & > #MENU-SIDE{ display: block; - position: absolute; + position: fixed; top: 0; left: 0; width: $menu-side-width; @@ -67,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 diff --git a/manager/Database.php b/manager/Database.php index dfe3052..89f874b 100755 --- a/manager/Database.php +++ b/manager/Database.php @@ -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': diff --git a/manager/module/callLog.php b/manager/module/call_log.php similarity index 99% rename from manager/module/callLog.php rename to manager/module/call_log.php index a7d7071..5cd6ac8 100644 --- a/manager/module/callLog.php +++ b/manager/module/call_log.php @@ -6,7 +6,7 @@ use \manager\ManagerError; use \manager\Repo; - class callLog{ + class call_log{ /* DESERIALISATION D'UN JOURNAL D'APPEL diff --git a/manager/module/charts.php b/manager/module/charts.php old mode 100644 new mode 100755 diff --git a/manager/module/token.php b/manager/module/token.php new file mode 100755 index 0000000..079dbe3 --- /dev/null +++ b/manager/module/token.php @@ -0,0 +1,109 @@ + UID du token en question + * + * @return status 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] Verification de l'existance du token + =========================================================*/ + $token_exists = new Repo('token/getById', array($id_token)); + + // On renvoie une erreur si le token n'existe pas + if( $token_exists->answer() == false ) return array('ModuleError' => ManagerError::Success, 'status' => false); + + + /* [2] Suppression du token + =========================================================*/ + $token_exists = new Repo('token/getById', array($id_token)); + + + /* [3] On verifie que le token soit supprime + =========================================================*/ + $token_removed = new Repo('token/getById', array($id_token)); + + // On renvoie une erreur si le token existe encore + if( $token_removed->answer() !== false ) return array('ModuleError' => ManagerError::Success, 'status' => false); + + + /* [n] Gestion du retour quand tout est normal + =========================================================*/ + return array( + 'ModuleError' => ManagerError::Success, + 'status' => true + ); + } + + + + + + + /* GENERE UN NOUVEAU TOKEN DE NOM ET EXPIRATION SPECIFIEE + * + * @name Nom attribue au token + * @duration Duree du token en jours + * + * @return id_token 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 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 + ); + } + + + + + + + + + + + + } + + +?> \ No newline at end of file diff --git a/manager/repo/token.php b/manager/repo/token.php index c127448..990729d 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -1,6 +1,7 @@ UID du token en question + * + * @return token 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 * @@ -82,8 +108,71 @@ } + /* GENERE UN NOUVEAU TOKEN DE NOM ET EXPIRATION SPECIFIEE + * + * @name Nom attribue au token + * @duration Duree du token en jours + * + * @return id_token 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 array('ModuleError' => ManagerError::ParamError); // erreur de parametre + /* [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, CURDATE()+:duration)"); + $create->execute(array( + ':token' => $token, + ':name' => $name, + ':duration' => $duration+1 + )); + + + /* [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 + AND duration = CURDATE()+:duration"); + $created->execute(array( + ':token' => $token, + ':name' => $name, + ':duration' => $duration+1 + )); + + // Si pas cree, on retourne une erreur + if( ($token=$created->fetch()) === false ) return false; + + + /* [4] On retourne l'id du token cree + =========================================================*/ + return $token['id_token']; + + } + } From 050f7259d4579b192f7756e8e1e10d6ffafa789e Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 11 Apr 2016 12:19:59 +0200 Subject: [PATCH 09/14] Correction pb de token interne --- manager/ResourceDispatcher.php | 21 +++++++++++++++++---- manager/sessionManager.php | 12 +++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/manager/ResourceDispatcher.php b/manager/ResourceDispatcher.php index 4a21abb..4f907fb 100755 --- a/manager/ResourceDispatcher.php +++ b/manager/ResourceDispatcher.php @@ -1,6 +1,8 @@ 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( '', $this->stylesheet.'', $svg_content ); + echo str_replace( '', $this->stylesheet.'', $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( '', $this->stylesheet.'', $svg_content ); + return str_replace( '', $this->stylesheet.'', $content ); } diff --git a/manager/sessionManager.php b/manager/sessionManager.php index 3963e00..94e0212 100755 --- a/manager/sessionManager.php +++ b/manager/sessionManager.php @@ -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'); } @@ -85,17 +85,15 @@ if( !$valid_sessid ) 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 ==============================================================*/ From dc40901143cc7aa84daef612345a8cc0e226909f Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 11 Apr 2016 12:20:14 +0200 Subject: [PATCH 10/14] Restitution de l'erreur numerique + textuelle --- manager/ModuleAnswer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manager/ModuleAnswer.php b/manager/ModuleAnswer.php index e3d5fc1..7869be7 100755 --- a/manager/ModuleAnswer.php +++ b/manager/ModuleAnswer.php @@ -137,7 +137,7 @@ public function serialize(){ // On rajoute l'erreur au message - $returnData = array_merge( array('ModuleError' => ManagerError::explicit($this->error)), $this->data ); + $returnData = array_merge( array('ModuleError' => $this->error, 'ErrorDescription' => ManagerError::explicit($this->error)), $this->data ); return json_encode($returnData); From 4487fb9e00bc9ea22ac29492e70ecb397d149743 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 11 Apr 2016 12:20:34 +0200 Subject: [PATCH 11/14] =?UTF-8?q?Gestion=20de=20la=20cr=C3=A9ation=20et=20?= =?UTF-8?q?suppression=20de=20token=20toutes=20les=20fonctions=20repo/modu?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- automate.php | 11 ++---- config/repositories.json | 4 +- css/global.css | 2 +- css/global.css.map | 2 +- css/global.scss | 2 +- js/action-script.js | 5 +++ js/lib/api.js | 12 +++++- manager/module/token.php | 34 ++++------------ manager/repo/token.php | 48 ++++++++++++++++++++--- view/js/settings.js | 85 +++++++++++++++++++++++++++++++++++----- view/settings.php | 14 +++---- 11 files changed, 158 insertions(+), 61 deletions(-) diff --git a/automate.php b/automate.php index 6c1eadf..1014be3 100755 --- a/automate.php +++ b/automate.php @@ -3,6 +3,7 @@ use \manager\ModuleRequest; use \manager\ResourceDispatcher; + use \manager\sessionManager; use \manager\ManagerError; use \manager\Repo; @@ -64,13 +65,7 @@ var_dump( $contact ); } - // parseCallLog(); + parseCallLog(); - - - $request = new ModuleRequest('token/generate', array('newtoken', '2') ); - $answer = $request->dispatch(); - - var_dump( ManagerError::explicit($request->error) ); - var_dump( $answer ); + ?> \ No newline at end of file diff --git a/config/repositories.json b/config/repositories.json index 24fd6f7..88d148c 100755 --- a/config/repositories.json +++ b/config/repositories.json @@ -7,8 +7,10 @@ "token": [ "getAll", "getById", + "check", - "generate" + "generate", + "remove" ] } \ No newline at end of file diff --git a/css/global.css b/css/global.css index 382a60b..1645009 100755 --- a/css/global.css +++ b/css/global.css @@ -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:.2em 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-top: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} +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:.2em 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 */ diff --git a/css/global.css.map b/css/global.css.map index da4bf12..d1d4f19 100755 --- a/css/global.css.map +++ b/css/global.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAEA,wBAAwB,CACvB,OAAO,CAAE,KAAK,CACd,QAAQ,CAAE,QAAQ,CAElB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,cAAc,CAEtB,gBAAgB,CAAE,IAAI,CAEt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U,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" diff --git a/css/global.scss b/css/global.scss index 3fe94b3..3574b9b 100755 --- a/css/global.scss +++ b/css/global.scss @@ -208,7 +208,7 @@ section[data-panel-list]{ padding: 1em; - border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; background-color: #f5f5f5; diff --git a/js/action-script.js b/js/action-script.js index af400fb..c90f70d 100755 --- a/js/action-script.js +++ b/js/action-script.js @@ -197,4 +197,9 @@ + /* [6] Gestion du rechargement de page + =========================================================*/ + function reload(){ navMenu( pageManager.page ); } + + // } \ No newline at end of file diff --git a/js/lib/api.js b/js/lib/api.js index b9209bc..ba2df59 100755 --- a/js/lib/api.js +++ b/js/lib/api.js @@ -10,6 +10,7 @@ APIClass.prototype = { * * @param pRequest l'objet passé en JSON à http://host/api/ * @param pHandler fonction qui s'éxécutera lors de la réponse (1 argument -> réponse) + * @param pToken si donne, token d'auth pour l'api * * @return answer 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 ); } diff --git a/manager/module/token.php b/manager/module/token.php index 079dbe3..6680eae 100755 --- a/manager/module/token.php +++ b/manager/module/token.php @@ -16,7 +16,7 @@ * * @id_token UID du token en question * - * @return status Retourne l'etat de la suppression (VRAI -> fait/FAUX -> erreur) + * @return status Retourne l'etat de la suppression (VRAI -> fait/FAUX -> erreur) * */ public static function remove($id_token){ @@ -25,33 +25,16 @@ if( !Database::check('id', $id_token) ) return array('ModuleError' => ManagerError::ParamError); - /* [1] Verification de l'existance du token + /* [1] Suppression du token =========================================================*/ - $token_exists = new Repo('token/getById', array($id_token)); - - // On renvoie une erreur si le token n'existe pas - if( $token_exists->answer() == false ) return array('ModuleError' => ManagerError::Success, 'status' => false); - - - /* [2] Suppression du token - =========================================================*/ - $token_exists = new Repo('token/getById', array($id_token)); - - - /* [3] On verifie que le token soit supprime - =========================================================*/ - $token_removed = new Repo('token/getById', array($id_token)); - - // On renvoie une erreur si le token existe encore - if( $token_removed->answer() !== false ) return array('ModuleError' => ManagerError::Success, 'status' => false); + $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, - 'status' => true - ); + return array( 'ModuleError' => ManagerError::Success ); } @@ -71,18 +54,17 @@ public static function generate($name, $duration){ /* [0] Verification des INPUT =========================================================*/ - if( !Database::check('varchar(50)', $name) || !Database::check('int', $duration) ) + 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 ); + if( $create->answer() === false ) return array('ModuleError' => ManagerError::ModuleError ); /* [2] Gestion du retour diff --git a/manager/repo/token.php b/manager/repo/token.php index 990729d..0d92c5b 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -93,7 +93,12 @@ if( !Database::check('sha1', $token) ) return false; - /* [1] Verification dans la base de donnees + /* [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 @@ -102,12 +107,14 @@ $check->execute(array( ':token' => $token )); - /* [2] On retourne le resultat + /* [3] On retourne le resultat =========================================================*/ return $check->fetch() !== false; } + + /* GENERE UN NOUVEAU TOKEN DE NOM ET EXPIRATION SPECIFIEE * * @name Nom attribue au token @@ -120,9 +127,8 @@ public static function generate($name, $duration){ /* [0] Verification des INPUT =========================================================*/ - if( !Database::check('varchar(50)', $name) || !Database::check('int', $duration) ) - return array('ModuleError' => ManagerError::ParamError); // erreur de parametre - + if( !Database::check('varchar(50)', $name) || !Database::check('int', $duration) ) return false; + /* [1] Generation d'un token si pas deja dans la BDD =========================================================*/ @@ -174,6 +180,38 @@ } + + + /* SUPPRIME UN TOKEN D'ID SPECIFIE + * + * @id_token UID du token en question + * + * @return status 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; + } + } diff --git a/view/js/settings.js b/view/js/settings.js index ef41127..e1f633d 100644 --- a/view/js/settings.js +++ b/view/js/settings.js @@ -1,19 +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 */ -var add_token_button = document.getElementById('add-token'); -var add_panel = document.querySelector('div[data-add]'); -/* (1.1) Gestion du toggle pour le panel de creation */ -var add_panel_state = true; -add_token_button.addEventListener('click', function(e){ + /* (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); - add_panel.className = (add_panel_state) ? 'active' : ''; + /* (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] + }; - add_panel_state = !add_panel_state; -}, false); + // 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); -/* (n) Gestion de la suppression de token */ -var remove_token_buttons = document.querySelectorAll('.remove-token'); \ No newline at end of file + + + + + + +/* (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); + +} \ No newline at end of file diff --git a/view/settings.php b/view/settings.php index 57338f0..aade2fa 100755 --- a/view/settings.php +++ b/view/settings.php @@ -29,7 +29,13 @@ $tokens = $req_tokens->answer(); -
Liste des accès distants actifs. Ils seront automatiquement désactivés a la date d'expiration.
+
Liste des accès distants actifs. Ils seront automatiquement désactivés a la date d'expiration. Veuillez toutefois les supprimer.
+ +
+

+

+ +
    @@ -60,12 +66,6 @@ $tokens = $req_tokens->answer();
- -
-

-

- -
From f227d44f7b6c1d2230331584124ec12851bbcb73 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 11 Apr 2016 14:07:52 +0200 Subject: [PATCH 12/14] Gestion des tokens internes (js) --- css/global.css | 2 +- css/global.css.map | 2 +- css/global.scss | 2 +- manager/module/token.php | 3 ++- manager/repo/token.php | 17 +++++++++-------- view/js/settings.js | 1 - 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/css/global.css b/css/global.css index 1645009..449a68e 100755 --- a/css/global.css +++ b/css/global.css @@ -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:.2em 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} +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 */ diff --git a/css/global.css.map b/css/global.css.map index d1d4f19..be7223f 100755 --- a/css/global.css.map +++ b/css/global.css.map @@ -1,6 +1,6 @@ { "version": 3, -"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,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css/global.scss +++ b/css/global.scss @@ -100,7 +100,7 @@ section[data-panel-list]{ align-items: center; flex-wrap: nowrap; - padding: .2em 1em; + padding: 1em; // rebord en bas sauf dernier &:not(:last-child){ diff --git a/manager/module/token.php b/manager/module/token.php index 6680eae..437bd9b 100755 --- a/manager/module/token.php +++ b/manager/module/token.php @@ -61,10 +61,11 @@ /* [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( $create->answer() === false ) return array('ModuleError' => ManagerError::ModuleError ); + if( $created === false ) return array('ModuleError' => ManagerError::ModuleError ); /* [2] Gestion du retour diff --git a/manager/repo/token.php b/manager/repo/token.php index 0d92c5b..1de4a40 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -128,6 +128,7 @@ /* [0] Verification des INPUT =========================================================*/ if( !Database::check('varchar(50)', $name) || !Database::check('int', $duration) ) return false; + /* [1] Generation d'un token si pas deja dans la BDD @@ -149,7 +150,7 @@ /* [2] On cree le token =========================================================*/ $create = Database::getPDO()->prepare("INSERT INTO api_token(id_token, token, name, expires) - VALUES(DEFAULT, :token, :name, CURDATE()+:duration)"); + VALUES(DEFAULT, :token, :name, DATEADD(day, :duration, NOW()) )"); $create->execute(array( ':token' => $token, ':name' => $name, @@ -161,21 +162,21 @@ =========================================================*/ $created = Database::getPDO()->prepare("SELECT id_token FROM api_token WHERE token = :token - AND name = :name - AND duration = CURDATE()+:duration"); + AND name = :name"); $created->execute(array( ':token' => $token, - ':name' => $name, - ':duration' => $duration+1 + ':name' => $name )); - + + $created_data = $created->fetch(); + // Si pas cree, on retourne une erreur - if( ($token=$created->fetch()) === false ) return false; + if( $created_data === false ) return false; /* [4] On retourne l'id du token cree =========================================================*/ - return $token['id_token']; + return $created_data['id_token']; } diff --git a/view/js/settings.js b/view/js/settings.js index e1f633d..e31f884 100644 --- a/view/js/settings.js +++ b/view/js/settings.js @@ -40,7 +40,6 @@ var TOKEN = { // 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(); From 30fea99ed6f9f85d74c31033228e9f9bab327115 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 11 Apr 2016 14:22:08 +0200 Subject: [PATCH 13/14] Correction de gestion de date d'expiration pour les tokens --- manager/repo/token.php | 15 ++++++++------- view/js/settings.js | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manager/repo/token.php b/manager/repo/token.php index 1de4a40..1843db0 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -102,7 +102,7 @@ =========================================================*/ $check = Database::getPDO()->prepare("SELECT id_token FROM api_token - WHERE CURDATE() < expires + WHERE CURDATE() <= expires AND token = :token"); $check->execute(array( ':token' => $token )); @@ -130,6 +130,8 @@ 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 =========================================================*/ @@ -150,14 +152,13 @@ /* [2] On cree le token =========================================================*/ $create = Database::getPDO()->prepare("INSERT INTO api_token(id_token, token, name, expires) - VALUES(DEFAULT, :token, :name, DATEADD(day, :duration, NOW()) )"); + VALUES(DEFAULT, :token, :name, :expiration)"); $create->execute(array( - ':token' => $token, - ':name' => $name, - ':duration' => $duration+1 + ':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 @@ -165,7 +166,7 @@ AND name = :name"); $created->execute(array( ':token' => $token, - ':name' => $name + ':name' => $name )); $created_data = $created->fetch(); diff --git a/view/js/settings.js b/view/js/settings.js index e31f884..f3a5139 100644 --- a/view/js/settings.js +++ b/view/js/settings.js @@ -40,6 +40,7 @@ var TOKEN = { // 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(); From ec9d10c71fc583a39f70ca57406f24d7a37c3517 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 11 Apr 2016 14:26:38 +0200 Subject: [PATCH 14/14] Correction de date d'expiration des tokens (inf OU EGAL a la date d'expiration) --- manager/repo/token.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/manager/repo/token.php b/manager/repo/token.php index 1843db0..545e996 100644 --- a/manager/repo/token.php +++ b/manager/repo/token.php @@ -33,22 +33,14 @@ public static function getAll(){ /* [1] On prepare et execute la requete =========================================================*/ - $request = Database::getPDO()->query("SELECT id_token as id, name, token, expires + $request = Database::getPDO()->query("SELECT id_token as id, name, token, expires, (CURDATE() > expires) as expired FROM api_token ORDER BY expires DESC"); - /* [2] On recupere les donnees et ajout le status d'expire ou non + + /* [3] On retourne les donnees =========================================================*/ - $data = Database::delNumeric( $request->fetchAll() ); - - // Si le token est expire - foreach($data as $i=>$token) - $data[$i]['expired'] = time() > strtotime($token['expires']); - - - /* [3] On retourne le resultat - =========================================================*/ - return $data; + return Database::delNumeric( $request->fetchAll() ); }