Sorry, this file is invalid so it cannot be displayed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You can't perform that action at this time.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You signed in with another tab or window. Reload to refresh your session.
+ You signed out in another tab or window. Reload to refresh your session.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/css/fonts/MaterialIcons-Regular.ttf b/css/fonts/MaterialIcons-Regular.ttf
index 0768c78c..7015564a 100644
Binary files a/css/fonts/MaterialIcons-Regular.ttf and b/css/fonts/MaterialIcons-Regular.ttf differ
diff --git a/css/fonts/MaterialIcons-Regular.woff b/css/fonts/MaterialIcons-Regular.woff
index 3a08d45e..b648a3ee 100644
Binary files a/css/fonts/MaterialIcons-Regular.woff and b/css/fonts/MaterialIcons-Regular.woff differ
diff --git a/css/fonts/MaterialIcons-Regular.woff2 b/css/fonts/MaterialIcons-Regular.woff2
index b1ffe8cf..9fa21125 100644
Binary files a/css/fonts/MaterialIcons-Regular.woff2 and b/css/fonts/MaterialIcons-Regular.woff2 differ
diff --git a/css/jquery.fancybox.css b/css/jquery.fancybox.css
new file mode 100644
index 00000000..d73c409f
--- /dev/null
+++ b/css/jquery.fancybox.css
@@ -0,0 +1,273 @@
+/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
+
+.fancybox-wrap,
+.fancybox-skin,
+.fancybox-outer,
+.fancybox-inner,
+.fancybox-image,
+.fancybox-wrap iframe,
+.fancybox-wrap object,
+.fancybox-nav,
+.fancybox-nav span,
+.fancybox-tmp {
+ padding: 0;
+ margin: 0;
+ border: 0;
+ outline: none;
+ vertical-align: top;
+}
+
+.fancybox-wrap {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 8020;
+}
+
+.fancybox-skin {
+ position: relative;
+ background: #f9f9f9;
+ color: #444;
+ text-shadow: none;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+}
+
+.fancybox-opened {
+ z-index: 8030;
+}
+
+.fancybox-opened .fancybox-skin {
+ -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
+ -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
+}
+
+.fancybox-outer, .fancybox-inner {
+ position: relative;
+}
+
+.fancybox-inner {
+ overflow: hidden;
+}
+
+.fancybox-type-iframe .fancybox-inner {
+ -webkit-overflow-scrolling: touch;
+}
+
+.fancybox-error {
+ color: #444;
+ font: 14px/20px "Helvetica Neue", Helvetica, Arial, sans-serif;
+ margin: 0;
+ padding: 15px;
+ white-space: nowrap;
+}
+
+.fancybox-image, .fancybox-iframe {
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+
+.fancybox-image {
+ max-width: 100%;
+ max-height: 100%;
+}
+
+#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
+ background-image: url('fancybox/fancybox_sprite.png');
+}
+
+#fancybox-loading {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ margin-top: -22px;
+ margin-left: -22px;
+ background-position: 0 -108px;
+ opacity: 0.8;
+ cursor: pointer;
+ z-index: 8060;
+}
+
+#fancybox-loading div {
+ width: 44px;
+ height: 44px;
+ background: url('fancybox/fancybox_loading.gif') center center no-repeat;
+}
+
+.fancybox-close {
+ position: absolute;
+ top: -18px;
+ right: -18px;
+ width: 36px;
+ height: 36px;
+ cursor: pointer;
+ z-index: 8040;
+}
+
+.fancybox-nav {
+ position: absolute;
+ top: 0;
+ width: 40%;
+ height: 100%;
+ cursor: pointer;
+ text-decoration: none;
+ background: transparent url('fancybox/blank.gif'); /* helps IE */
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ z-index: 8040;
+}
+
+.fancybox-prev {
+ left: 0;
+}
+
+.fancybox-next {
+ right: 0;
+}
+
+.fancybox-nav span {
+ position: absolute;
+ top: 50%;
+ width: 36px;
+ height: 34px;
+ margin-top: -18px;
+ cursor: pointer;
+ z-index: 8040;
+ visibility: hidden;
+}
+
+.fancybox-prev span {
+ left: 10px;
+ background-position: 0 -36px;
+}
+
+.fancybox-next span {
+ right: 10px;
+ background-position: 0 -72px;
+}
+
+.fancybox-nav:hover span {
+ visibility: visible;
+}
+
+.fancybox-tmp {
+ position: absolute;
+ top: -99999px;
+ left: -99999px;
+ visibility: hidden;
+ max-width: 99999px;
+ max-height: 99999px;
+ overflow: visible !important;
+}
+
+/* Overlay helper */
+
+.fancybox-lock {
+ overflow: hidden !important;
+ width: auto;
+}
+
+.fancybox-lock body {
+ overflow: hidden !important;
+}
+
+.fancybox-lock-test {
+ overflow-y: hidden !important;
+}
+
+.fancybox-overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ overflow: hidden;
+ display: none;
+ z-index: 8010;
+ background: url('fancybox/fancybox_overlay.png');
+}
+
+.fancybox-overlay-fixed {
+ position: fixed;
+ bottom: 0;
+ right: 0;
+}
+
+.fancybox-lock .fancybox-overlay {
+ overflow: auto;
+ overflow-y: scroll;
+}
+
+/* Title helper */
+
+.fancybox-title {
+ visibility: hidden;
+ font: normal 13px/20px "Helvetica Neue", Helvetica, Arial, sans-serif;
+ position: relative;
+ text-shadow: none;
+ z-index: 8050;
+}
+
+.fancybox-opened .fancybox-title {
+ visibility: visible;
+}
+
+.fancybox-title-float-wrap {
+ position: absolute;
+ bottom: 0;
+ right: 50%;
+ margin-bottom: -35px;
+ z-index: 8050;
+ text-align: center;
+}
+
+.fancybox-title-float-wrap .child {
+ display: inline-block;
+ margin-right: -100%;
+ padding: 2px 20px;
+ background: transparent; /* Fallback for web browsers that doesn't support RGBa */
+ background: rgba(0, 0, 0, 0.8);
+ -webkit-border-radius: 15px;
+ -moz-border-radius: 15px;
+ border-radius: 15px;
+ text-shadow: 0 1px 2px #222;
+ color: #FFF;
+ font-weight: bold;
+ line-height: 24px;
+ white-space: nowrap;
+}
+
+.fancybox-title-outside-wrap {
+ position: relative;
+ margin-top: 10px;
+ color: #fff;
+}
+
+.fancybox-title-inside-wrap {
+ padding-top: 10px;
+}
+
+
+.fancybox-title-over-wrap {
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ color: #fff;
+ padding: 10px;
+ background: #000;
+ background: rgba(0, 0, 0, .8);
+}
+
+/*Retina graphics!*/
+@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) {
+
+ #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
+ background-image: url('fancybox/fancybox_sprite@2x.png');
+ background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/
+ }
+
+ #fancybox-loading div {
+ background-image: url('fancybox/fancybox_loading@2x.gif');
+ background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/
+ }
+}
\ No newline at end of file
diff --git a/css/material-icons.css b/css/material-icons.css
new file mode 100644
index 00000000..b4761308
--- /dev/null
+++ b/css/material-icons.css
@@ -0,0 +1,37 @@
+/* Iconos de MDL */
+.material-icons {
+ font-family: 'Material Icons';
+ font-weight: normal;
+ font-style: normal;
+ font-size: 24px; /* Preferred icon size */
+ display: inline-block;
+ width: 1em;
+ height: 1em;
+ line-height: 1;
+ text-transform: none;
+ letter-spacing: normal;
+ word-wrap: normal;
+
+ /* Support for all WebKit browsers. */
+ -webkit-font-smoothing: antialiased;
+ /* Support for Safari and Chrome. */
+ text-rendering: optimizeLegibility;
+
+ /* Support for Firefox. */
+ -moz-osx-font-smoothing: grayscale;
+
+ /* Support for IE. */
+ font-feature-settings: 'liga';
+}
+
+.material-icons.md-18 { font-size: 18px; }
+.material-icons.md-24 { font-size: 24px; }
+.material-icons.md-36 { font-size: 36px; }
+.material-icons.md-48 { font-size: 48px; }
+.material-icons.md-60 { font-size: 60px; }
+
+.material-icons.md-dark { color: rgba(0, 0, 0, 0.54); }
+.material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); }
+
+.material-icons.md-light { color: rgba(255, 255, 255, 1); }
+.material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); }
\ No newline at end of file
diff --git a/css/styles.min.css b/css/styles.min.css
new file mode 100644
index 00000000..902dd26d
--- /dev/null
+++ b/css/styles.min.css
@@ -0,0 +1 @@
+*{font-family:Verdana,Tahoma,sans-serif}html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#000;font-size:12px;font-weight:normal}table{font-size:11px;border-spacing:0}#tblTools,#tblAccion{border:0;border:1px solid #d9d9d9;background-color:#f9f9f9;vertical-align:middle}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9 !important}table tr.even:hover{background-color:#e8ff99}table tr.odd:hover{background-color:#e8ff99}table tr{height:20px}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;border:0 solid #5dd;margin:0}input,select,textarea{background-color:#fffef0;color:black;font-size:11px;border:1px solid #dfdfdf;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,0.075) inset;padding:5px}input:hover,select:hover,textarea:hover{background-color:#fffccd}input:active,select:hover,textarea:active{background-color:#fffde1;color:#045fb4;border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,0.1) inset,0 0 5px rgba(88,151,251,0.5)}input:focus,select:hover,textarea:focus{background-color:#fffccd;color:#045fb4;border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,0.1) inset,0 0 5px rgba(88,151,251,0.5)}input{width:200px}input.inputImg,img.inputImg{background-color:transparent !important;width:24px !important;height:24px !important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px;resize:none}select.files{width:250px}input#rpp{width:40px}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent !important;width:16px !important;height:16px !important;margin:0 5px 0 5px;border:0;vertical-align:middle}.altTable{border:0;font-size:10px}.altTable .section{font-size:14px;font-weight:bold}.altTxtError{color:#c00;font-weight:bold}.altTxtOk{color:green;font-weight:bold}.altTxtWarn{color:orange;font-weight:bold}.altTxtGreen{color:green}.altTxtRed{color:darkred}.altTxtBlue{color:#339;font-weight:bold}a{text-decoration:none;color:#339}a:visited{text-decoration:none;color:#339}a:hover{text-decoration:none;color:orangered;cursor:pointer}a:active{text-decoration:none;color:#b00}a:focus{text-decoration:none;color:red}#nojs{width:80%;margin:auto;text-align:center;vertical-align:middle;margin-bottom:10px;margin-top:10px;padding:3px;background-color:red;color:white;font-weight:bold;font-size:14px}#wrap{height:auto !important;min-height:100%;min-width:1024px;height:100%;width:100%;background-color:#f5f5f5}#container{margin:auto;width:80%}#container.main{width:100%;height:auto;min-height:650px;background:url("../imgs/logo_full.svg") no-repeat left top transparent;background-size:300px}#container.error,#container.install,#container.passreset{width:100%}#container #header{width:100%;margin-bottom:15px}#container #session{width:35%;margin:0 auto;height:25px;background:url("../imgs/bg_session.png") repeat-x scroll left top #e9e9e9;color:#999;font-size:10px;text-align:right}#container #session img{width:24px;height:24px;margin-left:10px;margin-right:10px;vertical-align:middle}#container #session .imgLang{width:28px;height:auto;filter:alpha(opacity=40);-moz-opacity:.4;opacity:.4}#container #actionsBar{float:left;position:relative;top:110px;left:40px;margin-right:90px;text-align:center}#container #actionsBar ul{list-style:none;margin:0;padding:0}#container #actionsBar li{padding:5px 10px;width:100%;height:50px;background:url("../imgs/bg_button.png") repeat-x scroll left top #f9f9f9;margin-bottom:10px;border:1px solid #f5f5f5;border-radius:15px;-webkit-border-radius:15px;-moz-border-radius:15px;box-shadow:5px 8px 6px -6px #a9a9a9;-webkit-box-shadow:5px 8px 6px -6px #a9a9a9;-moz-box-shadow:5px 8px 6px -6px #a9a9a9}#container #actionsBar li:hover{border:1px solid #5897fb;box-shadow:0 0 5px rgba(88,151,251,0.5)}#container #actionsBar li img{width:32px;height:32px;position:relative;top:10px}#container #content{float:left;width:85%;min-height:500px;margin:50px auto;margin-bottom:80px}#content td.descField,#fancyContainer td.descField{text-align:right;padding-right:20px;width:25%;font-weight:bold;border-right:1px solid #d9d9d9;color:#555}#content td.valField,#fancyContainer td.valField{padding-left:20px;width:100%}#content #tblTools{min-width:875px;height:5em;padding:5px;padding-left:15px}#content #resBuscar{min-width:875px;min-height:450px;margin-bottom:50px}#content #resBuscar img{vertical-align:middle}#content #pageNav{float:left;clear:both;width:98%;margin-top:15px;height:1.5em;padding:5px 10px 5px 10px;vertical-align:middle;font-size:11px;color:#999;border:1px solid #d9d9d9;background-color:#f5f5f5}#content #pageNav img{margin-left:5px;vertical-align:middle}#content #pageNav a{margin-left:5px;font-size:12px;color:#999}#content #pageNav .current{margin-left:5px;color:darkorange}#content #pageNav>div{float:left;width:50%;height:1.5em;line-height:1.5em}#content #pageNav #pageNavLeft{text-align:left}#content #pageNav #pageNavRight{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleGreen{background:url("../imgs/bg_tab_new.png") repeat-x scroll left top #a9c1d7}#content #title.titleOrange{background:url("../imgs/bg_tab_edit.png") repeat-x scroll left top #a9c1d7}#content #title.titleRed{background:url("../imgs/bg_tab_edit.png") repeat-x scroll left top #a9c1d7}#content #title.titleNormal{color:#999;background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Q5ZDlkOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNkOWQ5ZDkiIHN0b3Atb3BhY2l0eT0iMCIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);background:-moz-linear-gradient(top,rgba(217,217,217,1) 0,rgba(217,217,217,0) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,rgba(217,217,217,1)),color-stop(100%,rgba(217,217,217,0)));background:-webkit-linear-gradient(top,rgba(217,217,217,1) 0,rgba(217,217,217,0) 100%);background:-o-linear-gradient(top,rgba(217,217,217,1) 0,rgba(217,217,217,0) 100%);background:-ms-linear-gradient(top,rgba(217,217,217,1) 0,rgba(217,217,217,0) 100%);background:linear-gradient(to bottom,rgba(217,217,217,1) 0,rgba(217,217,217,0) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d9d9d9',endColorstr='#00d9d9d9',GradientType=0)}#content .data{width:90%;padding:10px;border:1px solid #c9c9c9;margin:auto;background-color:#f9f9f9}#content .data td{text-align:left}#content .data td.descField{text-align:right;font-size:12px;font-weight:bold;color:#999}#content .data select{min-width:210px}#content .data #files-wrap{max-height:100px;width:400px;overflow-y:auto;border:1px solid #dfdfdf;padding:.5em}#content .data #files-list{list-style-type:none;margin:0;padding:0}#content .data #files-list li{background:#f2f2f2;padding:1em;font-size:1em;margin-bottom:5px}#content .data #files-list li:hover{background:#fffccd;color:#000}#content .data #files-list li img{float:right;position:relative;top:-5px;vertical-align:middle}#content .data #dropzone{width:350px;padding:5px;height:50px;margin-top:10px;border:2px dashed #d9d9d9;text-align:center}#content .data #dropzone img{vertical-align:middle}#content .data #fileUpload{display:none}#content .data .account-permissions{float:left;margin-right:10px}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content .extra-info{margin-top:20px}#content .tblIcon{background:url("../imgs/clock.png") no-repeat 98% 5% #f9f9f9}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff2d9;color:orange;font-weight:bold}#content #tblAccion{width:100%}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#045fb4}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{float:left;display:block;padding:.5em;font-weight:bold;letter-spacing:.2em;color:#696969}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{margin:0}#content .data-header-minimal li{font-weight:normal;letter-spacing:normal}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-rows li{float:left;display:block;padding:1.5em .5em;color:#696969;text-align:center;background-color:#fcfcfc;height:1em}#content .data-rows li.cell-nodata{padding:1em 0;height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;height:2em;padding:1em 0;text-align:center;background-color:#fcfcfc}#content .data-rows li.cell-actions:hover{background-color:#fffef0 !important}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img,#content #data-search .account-info img,#content #data-search .account-actions img{width:24px;height:24px;margin:0 .5em}#content #data-search{text-align:center}#content #data-search .account-label{width:310px;height:195px;text-align:left;margin:1em;padding:.5em;color:#696969;background-color:#fcfcfc;display:inline-block}#content #data-search .account-label .label-field{width:100%;height:2em}#content #data-search .account-label .field-name{float:left;width:80px;padding:.4em .2em;color:#b9b9b9}#content #data-search .account-label .field-text{float:left;width:215px;padding:.4em .2em}#content #data-search .account-label .header .field-name{color:white;font-weight:bold}#content #data-search .account-label .field-customer .field-name{display:none}#content #data-search .account-label .field-customer .field-text{width:304px}#content #data-search .account-label .field-url{height:2.5em}#content #data-search .account-label .field-text a{color:#4895fa}#content #data-search .account-label .no-link,#content #data-search .account-label .no-link a{color:white;font-weight:bold}#content #data-search .account-info{width:100%;height:2em;padding:.5em 0;text-align:left}#content #data-search .account-actions{width:100%;height:2.5em;padding-top:5px;text-align:right;background-color:#f5f5f5;box-shadow:0 0 8px rgba(0,0,0,0.075) inset}#content .actions-optional{display:none}#content #data-search .account-spacer{width:100%;height:7.5em}#content .rowSpace>.cellBorder{height:10px;border-top:1px solid #d9d9d9}#content .rowSpace>.cellBlank{height:10px}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #tblTools div.chosen-container{margin:0 5px}#content #tblTools #txtSearch,#content #tblTools select{min-width:180px}#content #tblTools label{margin-left:15px;color:#999}#content #tblTools #toolsLeft{text-align:left;width:80%}#content #tblTools #toolsRight{text-align:right;width:5%}#content #tblTools #toolsRight input{margin-left:15px;text-align:center}#content #tblTools .custom-combobox{margin-left:25px}#content #tblTools #btnClear{opacity:.35;filter:alpha(opacity=35)}#content #tblTools #btnClear:hover{opacity:1;filter:alpha(opacity=100)}#content #tblTools #order{margin-top:.5em;padding:.3em;color:#696969}#content #tabs>div{min-height:475px}#content #tabs.ui-widget-content{border:0;background-color:transparent}#content #tabs .ui-widget-header{background:0;border:0;border-bottom:1px solid #c9c9c9}#content #tabs.ui-widget-content{background:none !important}#content #tabs .tabs-spacer{float:left;height:200px}#content .tabs-bottom .ui-tabs-nav{clear:left;padding:0 .2em .2em .2em}#content .tabs-bottom .ui-tabs-nav li{top:auto;bottom:0;margin:0 .2em 1px 0;border-bottom:auto;border-top:0}#content .tabs-bottom .ui-tabs-nav li.ui-tabs-active{margin-top:-1px;padding-top:1px}#datos{float:left;width:400px;text-align:left;margin-top:10px;color:#b9b9b9}#datos a{color:orange;font-weight:bold;border:0;padding:3px;margin:5px 0 5px 0;display:block;width:40px;text-align:center;background-color:transparent}#datos img{border:0}#resAccion,#resFancyAccion{height:20px;padding:5px;margin:5px;font-weight:bold;font-size:14px}#resAccion span{padding:5px;border:#a9a9a9 1px solid}#fancyView{min-width:250px;text-align:center;padding:15px;line-height:20px;border:#d9d9d9 1px solid;font-size:14px}#fancyView.msgError{margin:5px;background-color:#fee8e6;color:#c00;font-weight:bold;border:#fed2ce 1px solid}#fancyView.msgOk{margin:5px;background-color:#ecfde4;color:green;font-weight:bold;border:#dbfdcb 1px solid}#fancyView.msgWarn{margin:5px;background-color:#fff2d9;color:orange;font-weight:bold;border:#ffe5b3 1px solid}#fancyView.msgInfo{margin:5px;background-color:#e9e9e9;color:orange;font-weight:bold;border:#ffe5b3 1px solid}#fancyView.backGrey{background-color:#f2f2f2 !important}#fancyView PRE{text-align:left}#fancyView table{border:0;width:100%;font-size:14px;text-align:left}#fancyView td{border-bottom:#d9d9d9 1px solid}#fancyMsg{min-width:250px;height:150px;background-color:#f5f5f5;font-family:Verdana,Arial;font-size:16px;text-align:center;display:table-cell;vertical-align:middle;font-weight:bold;border:0;line-height:20px;padding:0 15px;border-radius:25px;-moz-border-radius:25px;-webkit-border-radius:25px}#fancyMsg table{border:0;width:100%;font-size:14px;text-align:left}#fancyMsg td{border-bottom:#d9d9d9 1px solid}#fancyMsg.msgError{background:url('../imgs/bg_msg_error.png') white repeat-x;color:#c00}#fancyMsg.msgOk{background:url('../imgs/bg_msg_ok.png') white repeat-x;color:green}#fancyMsg.msgWarn{background:url('../imgs/bg_msg_warn.png') white repeat-x;color:orange}#fancyMsg.msgInfo{background:url('../imgs/bg_msg_info.png') white repeat-x;color:#555}#fancyView a,#fancyMsg a{color:#555}#fancyContainer{padding:0 15px 15px 15px}#fancyContainer h2{width:80%;height:1.5em;font-size:18px;color:white;background:url("../imgs/bg_h2.png") repeat-x scroll left top #a9c1d7;margin:0;margin-bottom:20px;padding-top:.3em}#fancyContainer select{width:220px}#fancyContainer.help{min-height:100px;background-color:#f5f5f5}#fancyContainer.help P{font-size:14px;text-align:justify;line-height:2em}#fancyContainer #resFancyAccion{display:none}#fancyContainer #resCheck{float:left;width:80%;height:4em;padding:1em 0}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:lightgoldenrodyellow;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.fancyNone{background-color:transparent !important}.fancydata{min-width:400px;border:0;text-align:left}.fancydata .descField{min-width:100px;font-weight:bold}footer{position:fixed;bottom:0;z-index:100;float:left;width:100%;height:1.5em;margin:0 auto;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:13px;box-shadow:0 -8px 6px -6px #c9c9c9;-webkit-box-shadow:0 -8px 6px -6px #c9c9c9;-moz-box-shadow:0 -8px 6px -6px #c9c9c9}footer #project{float:right;width:40%;text-align:right;padding-right:20px}footer #updates{float:left;width:20%;text-align:left;padding-left:20px}footer #status{float:left;width:20%;text-align:left;color:#ffbbb4}footer a,footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round{border-radius:10px !important;-moz-border-radius:10px !important;-webkit-border-radius:10px !important}.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 15px 15px !important;-moz-border-radius:0 0 15px 15px !important;-webkit-border-radius:0 0 15px 15px !important}.midroundup{border-radius:15px 15px 0 0 !important;-moz-border-radius:15px 15px 0 0 !important;-webkit-border-radius:15px 15px 0 0 !important}.fullround{border-radius:50% !important;-moz-border-radius:50% !important;-webkit-border-radius:50% !important}.iconMini{width:16px !important;height:16px !important;vertical-align:middle}#content .error{width:350px;margin:15px;padding:15px;background-color:#f9f9f9;color:orange;border:orange 1px solid;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em}.hide{display:none !important}.btn-checks{border:1px solid #d9d9d9;padding:5px;margin:5px 0}.btn-checks .ui-button{width:150px;margin:5px !important}.shadow{box-shadow:3px 3px 6px -3px #d9d9d9;-webkit-box-shadow:3px 3px 6px -3px #a9a9a9;-moz-box-shadow:3px 3px 6px -3px #a9a9a9}.noRes{width:60%;margin:15px;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-blue{background-color:#e6f2ff}.header-grey{background:url("../imgs/bg_table_header.png") repeat-x scroll left top #f2f2f2;height:30px;text-align:center}.no-background{background:none !important}.action{max-width:90%;height:4em;margin:.7em auto;text-align:right}.action-in-box{float:right;height:4em;margin:.7em 0;text-align:right}.action ul{list-style:none;margin:0;padding:0;padding-right:2em}.action-in-box ul{list-style:none;margin:0;padding:0}.action li{float:right;width:2em;height:2em;margin-left:3em}.action li img,.action-in-box li img{padding:1em;border:1px solid #d9d9d9;border-radius:3em;background-color:#f9f9f9 !important}.fullWidth{max-width:100% !important}.filterOn{padding:.3em 1em;background-color:#ecfde4;color:green!important;border:#dbfdcb 1px solid!important}.globalOn{padding:.3em 1em;background-color:#fff2d9;color:orange!important;border:#ffe5b3 1px solid!important}.opacity50{filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.ui-tooltip{background:#ffffa3;color:#555;padding:10px;border-radius:10px;box-shadow:0 0 7px #a9a9a9}.ui-autocomplete,.ui-menu-item{z-index:8050}.ui-buttonset .ui-state-active{background:url("smoothness/images/ui-bg_glass_75_ON_1x400.png") repeat-x scroll 50% 50% #ecfde4;border:1px solid #aaa;color:#212121;font-weight:normal}.valField .ui-state-active,#tblTools .ui-state-active,#frmInstall .ui-state-active{background:url("smoothness/images/ui-bg_glass_75_ON_1x400.png") repeat-x scroll 50% 50% #ecfde4}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest,.passLevel.strongest:hover{background-color:#ecfde4 !important;color:green;font-weight:bold;border:lightgreen 1px solid}.passLevel.strong,.passLevel.strong:hover{background-color:#e6f2ff !important;color:#64b4f4;font-weight:bold;border:#64b4f4 1px solid}.passLevel.good,.passLevel.good:hover{background-color:#fff2d9 !important;color:orange;font-weight:bold;border:#ffe5b3 1px solid}.passLevel.weak,.passLevel.weak:hover{background-color:#fee8e6 !important;color:#c00;font-weight:bold;border:#fed2ce 1px solid}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}#boxLogin{width:450px;height:150px;margin:75px auto;padding:25px;background-color:#fff}#boxLogin .error{float:left;width:315px;margin-top:15px;color:orange;border:1px orange solid;margin-left:auto;margin-right:auto}#boxLogin #boxLogo{float:left;width:150px;height:100%;text-align:center}#boxLogin #boxLogo #imgLogo{float:left;width:150px;height:150px;position:relative;z-index:90;vertical-align:middle}#boxLogin #boxData{float:left;width:280px;min-height:100px;padding:20px 0;text-align:left;margin-left:auto;margin-right:auto;background-color:transparent}#boxLogin #boxData label{float:left;width:120px;padding:5px;margin:10px 20px 0 10px;color:#045fb4;font-weight:bold;font-size:14px}#boxLogin #boxData input{float:left;margin-top:10px;margin-left:40px;border:1px solid #ddd;color:#039;width:150px;background-color:#f5f5f5;font-size:14px}#boxLogin #boxData #btnLogin{float:right;width:24px;height:24px;margin-top:15px;border:0;padding:0;background-color:transparent !important}#boxLogin #boxData input:active,#boxLogin #boxData input:focus{border:1px solid #5897fb}#boxLogin #boxActions{float:left;width:100%;padding:.5em;text-align:right}#boxLogin #boxActions a{color:#c9c9c9}#boxLogout{width:250px;margin:0 auto;font-size:14px;text-align:center;color:orange;background:#fff2d9;border:#ffe5b3 1px solid;padding:.5em}#boxUpdated{width:350px;margin:0 auto;font-size:14px;text-align:center;color:green;background:#ecfde4;border:#dbfdcb 1px solid;padding:.5em}fieldset.warning{padding:8px;color:#b94a48;background-color:#f2dede;border:1px solid #eed3d7;border-radius:5px}fieldset.warning legend{color:#b94a48 !important}fieldset.warning a{color:#b94a48 !important;font-weight:bold}#actions{width:100%;margin:auto;margin-bottom:50px;line-height:2em}#actions #logo{width:100%;margin-bottom:30px;font-size:18px;font-weight:bold;text-align:center;color:#a9a9a9;letter-spacing:3px;box-shadow:0 8px 6px -6px #a9a9a9;-webkit-box-shadow:0 8px 6px -6px #a9a9a9;-moz-box-shadow:0 8px 6px -6px #a9a9a9}#actions #logo img{display:inline-block;width:400px}#actions #logo #pageDesc{position:relative;top:30px;left:-10em;text-shadow:3px 3px #fff}#actions ul.errors{max-width:40%;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:5px;padding:.5em}#actions ul.errors>li.err_critical{color:#b94a48;background:#fed7d7;border:1px solid red}#actions ul.errors>li.err_warning{color:orange;background:#fff2d9;border:#ffe5b3 1px solid}#actions ul.errors>li.err_ok{color:green;background:#ecfde4;border:#dbfdcb 1px solid;font-weight:bold}#actions ul.errors>li>p.hint{background-image:url('../imgs/info.png');background-repeat:no-repeat;color:#777;padding-left:25px;background-position:0 .3em;font-size:12px}#actions form fieldset legend{width:100%;margin-top:1em;text-align:center;font-weight:bold;color:#999;text-shadow:0 1px 0 white;font-size:14px}#actions input[type="text"],#actions input[type="password"],#actions input[type="email"]{margin-top:.5em;border:1px solid #a9a9a9;font-size:14px;-moz-box-shadow:0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.25) inset;-webkit-box-shadow:0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.25) inset;box-shadow:0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.25) inset}#actions form input[type="checkbox"]+label{position:relative;margin:0;font-size:1em;text-shadow:#fff 0 1px 0}#actions .button{display:inline-block;width:150px;margin:15px;padding:5px;text-align:center;border:1px solid #d9d9d9;background-color:#777;color:#fff;font-weight:bold;cursor:pointer;font-size:16px;box-shadow:3px 3px 3px -3px #a9a9a9;-webkit-box-shadow:8px 8px 6px -6px #a9a9a9;-moz-box-shadow:8px 8px 6px -6px #a9a9a9}#actions.installer form{width:400px;margin:0 auto;text-align:left}#actions.installer form fieldset{border:0}#actions.installer form legend{text-align:left;border-bottom:1px solid #dfdfdf;margin-bottom:1em}#actions.installer form fieldset p{width:300px;margin:0 auto}#actions.installer div.buttons{margin-top:1em;text-align:center}#whatsNewIcon{text-align:center}#whatsNewIcon img{width:64px;height:64px}#whatsNewIcon h2{display:inline-block;color:#555;font-size:16px}#whatsNew{margin:0 auto;width:500px;background-color:#fffde1;padding:2em;line-height:1.5em;font-size:16px;color:#555;border:1px solid #d9d9d9;margin-bottom:3em;display:none}#whatsNew ul{padding:0;border:0}#whatsNew li{padding-left:37px;background:url("../imgs/arrow-list.png") left center no-repeat;line-height:32px;list-style:none}
\ No newline at end of file
diff --git a/inc/SP/Account/AccountAcl.class.php b/inc/SP/Account/AccountAcl.class.php
new file mode 100644
index 00000000..172c8605
--- /dev/null
+++ b/inc/SP/Account/AccountAcl.class.php
@@ -0,0 +1,324 @@
+.
+ */
+
+namespace SP\Account;
+
+use SP\Core\Acl;
+use SP\Util\Checks;
+
+/**
+ * Class AccountAcl
+ *
+ * @package SP\Account
+ */
+class AccountAcl
+{
+ /**
+ * @var AccountBase
+ */
+ protected $Account;
+ /**
+ * @var int
+ */
+ protected $action;
+ /**
+ * @var bool
+ */
+ protected $modified = false;
+ /**
+ * @var bool
+ */
+ protected $showView = false;
+ /**
+ * @var bool
+ */
+ protected $showHistory = false;
+ /**
+ * @var bool
+ */
+ protected $showDetails = false;
+ /**
+ * @var bool
+ */
+ protected $showPass = false;
+ /**
+ * @var bool
+ */
+ protected $showFiles = false;
+ /**
+ * @var bool
+ */
+ protected $showViewPass = false;
+ /**
+ * @var bool
+ */
+ protected $showSave = false;
+ /**
+ * @var bool
+ */
+ protected $showEdit = false;
+ /**
+ * @var bool
+ */
+ protected $showEditPass = false;
+ /**
+ * @var bool
+ */
+ protected $showDelete = false;
+ /**
+ * @var bool
+ */
+ protected $showRestore = false;
+ /**
+ * @var bool
+ */
+ protected $showLink = false;
+ /**
+ * @var bool
+ */
+ protected $showCopy = false;
+
+ /**
+ * @return boolean
+ */
+ public function isShowDetails()
+ {
+ return $this->showDetails;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowPass()
+ {
+ return $this->showPass;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowFiles()
+ {
+ return $this->showFiles;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowViewPass()
+ {
+ return $this->showViewPass;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowSave()
+ {
+ return $this->showSave;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowEdit()
+ {
+ return $this->showEdit;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowEditPass()
+ {
+ return $this->showEditPass;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowDelete()
+ {
+ return $this->showDelete;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowRestore()
+ {
+ return $this->showRestore;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowLink()
+ {
+ return $this->showLink;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowHistory()
+ {
+ return $this->showHistory;
+ }
+
+ /**
+ * Obtener la ACL de una cuenta
+ *
+ * @param AccountBase $Account
+ * @param int $action
+ * @return $this
+ */
+ public function getAcl (AccountBase $Account, $action)
+ {
+ $this->Account = $Account;
+ $this->action = $action;
+
+ $this->makeAcl();
+
+ return $this;
+ }
+
+ /**
+ * Crear la ACL de una cuenta
+ */
+ protected function makeAcl()
+ {
+ $aclData = $this->Account->getAccountDataForACL();
+
+ // Mostrar historial
+ $this->showHistory =
+ ($this->action === Acl::ACTION_ACC_VIEW
+ || $this->action === Acl::ACTION_ACC_VIEW_HISTORY)
+ && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_HISTORY)
+ && ($this->modified || $this->action === Acl::ACTION_ACC_VIEW_HISTORY);
+
+ // Mostrar detalles
+ $this->showDetails =
+ $this->action === Acl::ACTION_ACC_VIEW
+ || $this->action === Acl::ACTION_ACC_VIEW_HISTORY
+ || $this->action === Acl::ACTION_ACC_DELETE;
+
+ // Mostrar campo de clave
+ $this->showPass = $this->action === Acl::ACTION_ACC_NEW || $this->action === Acl::ACTION_ACC_COPY;
+
+ // Mostrar lista archivos
+ $this->showFiles =
+ ($this->action === Acl::ACTION_ACC_EDIT
+ || $this->action === Acl::ACTION_ACC_VIEW
+ || $this->action === Acl::ACTION_ACC_VIEW_HISTORY)
+ && Checks::fileIsEnabled()
+ && Acl::checkUserAccess(Acl::ACTION_ACC_FILES);
+
+ // Mostrar acción de ver clave
+ $this->showViewPass =
+ ($this->action === Acl::ACTION_ACC_SEARCH
+ || $this->action === Acl::ACTION_ACC_VIEW
+ || $this->action === Acl::ACTION_ACC_VIEW_HISTORY)
+ && Acl::checkAccountAccess(Acl::ACTION_ACC_VIEW_PASS, $aclData)
+ && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_PASS);
+
+ // Mostrar acción de guardar
+ $this->showSave = $this->action === Acl::ACTION_ACC_EDIT || $this->action === Acl::ACTION_ACC_NEW || $this->action === Acl::ACTION_ACC_COPY;
+
+ // Mostrar acción de editar
+ $this->showEdit =
+ ($this->action === Acl::ACTION_ACC_SEARCH
+ || $this->action === Acl::ACTION_ACC_VIEW)
+ && Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT, $aclData)
+ && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT)
+ && !$this->Account->getAccountIsHistory();
+
+ // Mostrar acción de editar clave
+ $this->showEditPass =
+ ($this->action === Acl::ACTION_ACC_EDIT
+ || $this->action === Acl::ACTION_ACC_VIEW)
+ && Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT_PASS, $aclData)
+ && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT_PASS)
+ && !$this->Account->getAccountIsHistory();
+
+ // Mostrar acción de eliminar
+ $this->showDelete =
+ ($this->action === Acl::ACTION_ACC_SEARCH
+ || $this->action === Acl::ACTION_ACC_DELETE
+ || $this->action === Acl::ACTION_ACC_EDIT)
+ && Acl::checkAccountAccess(Acl::ACTION_ACC_DELETE, $aclData)
+ && Acl::checkUserAccess(Acl::ACTION_ACC_DELETE);
+
+ // Mostrar acción de restaurar
+ $this->showRestore = $this->action === Acl::ACTION_ACC_VIEW_HISTORY
+ && Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT, $this->Account->getAccountDataForACL($this->Account->getAccountParentId()))
+ && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT);
+
+ // Mostrar acción de enlace público
+ $this->showLink = Checks::publicLinksIsEnabled() && Acl::checkUserAccess(Acl::ACTION_MGM_PUBLICLINKS);
+
+ // Mostrar acción de ver cuenta
+ $this->showView = Acl::checkAccountAccess(Acl::ACTION_ACC_VIEW, $aclData) && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW);
+
+ // Mostrar acción de copiar cuenta
+ $this->showCopy =
+ ($this->action === Acl::ACTION_ACC_SEARCH
+ || $this->action === Acl::ACTION_ACC_VIEW
+ || $this->action === Acl::ACTION_ACC_EDIT)
+ && Acl::checkAccountAccess(Acl::ACTION_ACC_COPY, $aclData)
+ && Acl::checkUserAccess(Acl::ACTION_ACC_COPY);
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isModified()
+ {
+ return $this->modified;
+ }
+
+ /**
+ * @param boolean $modified
+ */
+ public function setModified($modified)
+ {
+ $this->modified = $modified;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowView()
+ {
+ return $this->showView;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isShowCopy()
+ {
+ return $this->showCopy;
+ }
+}
\ No newline at end of file
diff --git a/inc/SP/Account/AccountBase.class.php b/inc/SP/Account/AccountBase.class.php
index e6777de7..be6c8949 100644
--- a/inc/SP/Account/AccountBase.class.php
+++ b/inc/SP/Account/AccountBase.class.php
@@ -72,7 +72,7 @@ abstract class AccountBase
*/
public function __construct(AccountData $accountData = null)
{
- $this->accountData = (!is_null($accountData)) ? $accountData : new AccountData();
+ $this->accountData = (null !== $accountData) ? $accountData : new AccountData();
}
/**
@@ -115,7 +115,7 @@ abstract class AccountBase
*/
public function getAccountDataForACL($accountId = null)
{
- $accId = (!is_null($accountId)) ? $accountId : $this->accountData->getAccountId();
+ $accId = (null !== $accountId) ? $accountId : $this->accountData->getAccountId();
$this->accountData->setAccountId($accId);
diff --git a/inc/SP/Account/AccountSearch.class.php b/inc/SP/Account/AccountSearch.class.php
index 48114fe3..ece5702e 100644
--- a/inc/SP/Account/AccountSearch.class.php
+++ b/inc/SP/Account/AccountSearch.class.php
@@ -66,7 +66,7 @@ class AccountSearch
*
* @var array
*/
- private $colors = array(
+ private $colors = [
'2196F3',
'03A9F4',
'00BCD4',
@@ -84,7 +84,7 @@ class AccountSearch
'9C27B0',
'673AB7',
'3F51B5',
- );
+ ];
/**
* @var bool
*/
@@ -129,7 +129,7 @@ class AccountSearch
/**
* Constructor
*/
- function __construct()
+ public function __construct()
{
$userResultsPerPage = (Session::getSessionType() === Session::SESSION_INTERACTIVE) ? Session::getUserPreferences()->getResultsPerPage() : 0;
@@ -310,7 +310,7 @@ class AccountSearch
$Data->addParam(Session::getUserGroupId(), 'groupId');
$Data->addParam(Session::getUserId(), 'userId');
} else {
- $query = "SELECT COUNT(*) as numacc FROM accounts";
+ $query = 'SELECT COUNT(*) as numacc FROM accounts';
}
$Data->setQuery($query);
@@ -337,24 +337,27 @@ class AccountSearch
}
// Variables de configuración
- $maxTextLength = (Checks::resultsCardsIsEnabled()) ? 40 : 60;
+ $maxTextLength = Checks::resultsCardsIsEnabled() ? 40 : 60;
$favorites = AccountFavorites::getFavorites(Session::getUserId());
- $Account = new Account(new AccountData());
$accountsData['count'] = self::$queryNumRows;
foreach ($results as $account) {
- $Account->getAccountData()->setAccountId($account->account_id);
- $Account->getAccountData()->setAccountUserId($account->account_userId);
- $Account->getAccountData()->setAccountUsersId($Account->getUsersAccount());
- $Account->getAccountData()->setAccountUserGroupId($account->account_userGroupId);
- $Account->getAccountData()->setAccountUserGroupsId($Account->getGroupsAccount());
- $Account->getAccountData()->setAccountOtherUserEdit($account->account_otherUserEdit);
- $Account->getAccountData()->setAccountOtherGroupEdit($account->account_otherGroupEdit);
+ // Establecer los datos de la cuenta
+ $Account = new Account();
+ $AccountData = $Account->getAccountData();
+ $AccountData->setAccountId($account->account_id);
+ $AccountData->setAccountUserId($account->account_userId);
+ $AccountData->setAccountUsersId($Account->getUsersAccount());
+ $AccountData->setAccountUserGroupId($account->account_userGroupId);
+ $AccountData->setAccountUserGroupsId($Account->getGroupsAccount());
+ $AccountData->setAccountOtherUserEdit($account->account_otherUserEdit);
+ $AccountData->setAccountOtherGroupEdit($account->account_otherGroupEdit);
- // Obtener los datos de la cuenta para aplicar las ACL
- $accountAclData = $Account->getAccountDataForACL();
+ // Obtener la ACL de la cuenta
+ $AccountAcl = new AccountAcl();
+ $AccountAcl->getAcl($Account, Acl::ACTION_ACC_SEARCH);
$AccountSearchData = new AccountsSearchData();
$AccountSearchData->setTextMaxLength($maxTextLength);
@@ -363,17 +366,17 @@ class AccountSearch
$AccountSearchData->setLogin($account->account_login);
$AccountSearchData->setCategoryName($account->category_name);
$AccountSearchData->setCustomerName($account->customer_name);
- $AccountSearchData->setCustomerLink((AccountsSearchData::$wikiEnabled) ? Config::getConfig()->getWikiSearchurl() . $account->customer_name : '');
+ $AccountSearchData->setCustomerLink(AccountsSearchData::$wikiEnabled ? Config::getConfig()->getWikiSearchurl() . $account->customer_name : '');
$AccountSearchData->setColor($this->pickAccountColor($account->account_customerId));
$AccountSearchData->setUrl($account->account_url);
$AccountSearchData->setFavorite(in_array($account->account_id, $favorites));
$AccountSearchData->setTags(AccountTags::getTags($Account->getAccountData()));
- $AccountSearchData->setNumFiles((Checks::fileIsEnabled()) ? $account->num_files : 0);
- $AccountSearchData->setShowView(Acl::checkAccountAccess(ActionsInterface::ACTION_ACC_VIEW, $accountAclData) && Acl::checkUserAccess(ActionsInterface::ACTION_ACC_VIEW));
- $AccountSearchData->setShowViewPass(Acl::checkAccountAccess(ActionsInterface::ACTION_ACC_VIEW_PASS, $accountAclData) && Acl::checkUserAccess(ActionsInterface::ACTION_ACC_VIEW_PASS));
- $AccountSearchData->setShowEdit(Acl::checkAccountAccess(ActionsInterface::ACTION_ACC_EDIT, $accountAclData) && Acl::checkUserAccess(ActionsInterface::ACTION_ACC_EDIT));
- $AccountSearchData->setShowCopy(Acl::checkAccountAccess(ActionsInterface::ACTION_ACC_COPY, $accountAclData) && Acl::checkUserAccess(ActionsInterface::ACTION_ACC_COPY));
- $AccountSearchData->setShowDelete(Acl::checkAccountAccess(ActionsInterface::ACTION_ACC_DELETE, $accountAclData) && Acl::checkUserAccess(ActionsInterface::ACTION_ACC_DELETE));
+ $AccountSearchData->setNumFiles(Checks::fileIsEnabled() ? $account->num_files : 0);
+ $AccountSearchData->setShowView($AccountAcl->isShowView());
+ $AccountSearchData->setShowViewPass($AccountAcl->isShowViewPass());
+ $AccountSearchData->setShowEdit($AccountAcl->isShowEdit());
+ $AccountSearchData->setShowCopy($AccountAcl->isShowCopy());
+ $AccountSearchData->setShowDelete($AccountAcl->isShowDelete());
// Obtenemos datos si el usuario tiene acceso a los datos de la cuenta
if ($AccountSearchData->isShow()) {
diff --git a/inc/SP/Config/Config.class.php b/inc/SP/Config/Config.class.php
index c8889ad5..3d8f87f8 100644
--- a/inc/SP/Config/Config.class.php
+++ b/inc/SP/Config/Config.class.php
@@ -26,7 +26,7 @@
namespace SP\Config;
use ReflectionObject;
-use SP\Core\SingleFactory;
+use SP\Core\DiFactory;
use SP\Core\Session;
use SP\Core\Exceptions\SPException;
@@ -103,8 +103,8 @@ class Config
$ConfigData->setConfigSaver(Session::getUserLogin());
$ConfigData->setConfigHash();
- SingleFactory::getConfigStorage()->setItems($ConfigData);
- SingleFactory::getConfigStorage()->save('config');
+ DiFactory::getConfigStorage()->setItems($ConfigData);
+ DiFactory::getConfigStorage()->save('config');
if ($backup) {
self::backupToDB();
@@ -126,7 +126,7 @@ class Config
self::$Config = new ConfigData();
try {
- $items = SingleFactory::getConfigStorage()->load('config')->getItems();
+ $items = DiFactory::getConfigStorage()->load('config')->getItems();
$Reflection = new ReflectionObject(self::$Config);
foreach ($Reflection->getProperties() as $property) {
diff --git a/inc/SP/Config/ConfigData.class.php b/inc/SP/Config/ConfigData.class.php
index e3259e2d..3dbe624c 100644
--- a/inc/SP/Config/ConfigData.class.php
+++ b/inc/SP/Config/ConfigData.class.php
@@ -81,7 +81,7 @@ class ConfigData implements JsonSerializable
/**
* @var int
*/
- private $proxyPort = 0;
+ private $proxyPort = 8080;
/**
* @var string
*/
diff --git a/inc/SP/Controller/AccItemMgmt.class.php b/inc/SP/Controller/AccItemController.class.php
similarity index 97%
rename from inc/SP/Controller/AccItemMgmt.class.php
rename to inc/SP/Controller/AccItemController.class.php
index f5855eb1..e8d7374a 100644
--- a/inc/SP/Controller/AccItemMgmt.class.php
+++ b/inc/SP/Controller/AccItemController.class.php
@@ -53,7 +53,7 @@ use SP\Util\Checks;
*
* @package SP\Controller
*/
-class AccItemMgmt extends Controller implements ActionsInterface
+class AccItemController extends ControllerBase implements ActionsInterface
{
/**
* Máximo numero de acciones antes de agrupar
@@ -74,7 +74,7 @@ class AccItemMgmt extends Controller implements ActionsInterface
parent::__construct($template);
$this->view->assign('isDemo', Checks::demoIsEnabled());
- $this->view->assign('sk', SessionUtil::getSessionKey(true));
+ $this->view->assign('sk', SessionUtil::getSessionKey());
}
/**
diff --git a/inc/SP/Controller/AccItemsMgmt.class.php b/inc/SP/Controller/AccItemsController.class.php
similarity index 98%
rename from inc/SP/Controller/AccItemsMgmt.class.php
rename to inc/SP/Controller/AccItemsController.class.php
index 5dc9a236..4f24eecb 100644
--- a/inc/SP/Controller/AccItemsMgmt.class.php
+++ b/inc/SP/Controller/AccItemsController.class.php
@@ -43,7 +43,7 @@ use SP\Mgmt\Users\UserUtil;
*
* @package Controller
*/
-class AccItemsMgmt extends GridTabController implements ActionsInterface
+class AccItemsController extends GridTabControllerBase implements ActionsInterface
{
/**
* @var int
diff --git a/inc/SP/Controller/AccItemsMgmtSearch.class.php b/inc/SP/Controller/AccItemsSearchController.class.php
similarity index 92%
rename from inc/SP/Controller/AccItemsMgmtSearch.class.php
rename to inc/SP/Controller/AccItemsSearchController.class.php
index 8db191f4..7c07e3be 100644
--- a/inc/SP/Controller/AccItemsMgmtSearch.class.php
+++ b/inc/SP/Controller/AccItemsSearchController.class.php
@@ -34,14 +34,13 @@ use SP\Mgmt\Groups\GroupSearch;
use SP\Mgmt\Profiles\ProfileSearch;
use SP\Mgmt\PublicLinks\PublicLinkSearch;
use SP\Mgmt\Users\UserSearch;
-use SP\Mgmt\Users\UserUtil;
/**
* Class AccItemsMgmtSearch para la gestión de búsquedas de items de accesos
*
* @package SP\Controller
*/
-class AccItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
+class AccItemsSearchController extends GridItemsSearchController implements ActionsInterface
{
/**
* Obtener los usuarios de una búsqueda
@@ -56,7 +55,7 @@ class AccItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getUsersGrid();
$Grid->getData()->setData(UserSearch::getItem()->getMgmtSearch($SearchData));
@@ -81,7 +80,7 @@ class AccItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getGroupsGrid();
$Grid->getData()->setData(GroupSearch::getItem()->getMgmtSearch($SearchData));
@@ -106,7 +105,7 @@ class AccItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getProfilesGrid();
$Grid->getData()->setData(ProfileSearch::getItem()->getMgmtSearch($SearchData));
@@ -131,7 +130,7 @@ class AccItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getTokensGrid();
$Grid->getData()->setData(ApiTokensUtil::getTokensMgmtSearch($SearchData));
@@ -156,7 +155,7 @@ class AccItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getPublicLinksGrid();
$Grid->getData()->setData(PublicLinkSearch::getItem()->getMgmtSearch($SearchData));
diff --git a/inc/SP/Controller/Account.class.php b/inc/SP/Controller/AccountController.class.php
similarity index 78%
rename from inc/SP/Controller/Account.class.php
rename to inc/SP/Controller/AccountController.class.php
index 741a768d..8c2e8120 100644
--- a/inc/SP/Controller/Account.class.php
+++ b/inc/SP/Controller/AccountController.class.php
@@ -27,6 +27,9 @@ namespace SP\Controller;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
+use SP\Account\Account;
+use SP\Account\AccountAcl;
+use SP\Account\AccountHistory;
use SP\DataModel\AccountData;
use SP\Core\Acl;
use SP\Config\Config;
@@ -37,7 +40,6 @@ use SP\Core\Template;
use SP\DataModel\CustomFieldData;
use SP\Mgmt\Groups\Group;
use SP\Mgmt\Groups\GroupAccountsUtil;
-use SP\Mgmt\Groups\GroupUtil;
use SP\Mgmt\PublicLinks\PublicLink;
use SP\Mgmt\CustomFields\CustomField;
use SP\Mgmt\Tags\Tag;
@@ -57,16 +59,12 @@ use SP\Util\Json;
*
* @package Controller
*/
-class Account extends Controller implements ActionsInterface
+class AccountController extends ControllerBase implements ActionsInterface
{
/**
- * @var int con la acción a realizar
+ * @var \SP\Account\Account|AccountHistory instancia para el manejo de datos de una cuenta
*/
- protected $action;
- /**
- * @var \SP\Account\Account|\SP\Account\AccountHistory instancia para el manejo de datos de una cuenta
- */
- private $account;
+ private $Account;
/**
* @var bool indica si se han obtenido datos de la cuenta
*/
@@ -126,17 +124,16 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account');
$this->view->assign('title',
- array(
+ [
'class' => 'titleGreen',
'name' => _('Nueva Cuenta'),
'icon' => $this->icons->getIconAdd()->getIcon()
- )
+ ]
);
$this->view->assign('nextaction', Acl::ACTION_ACC_NEW);
Session::setLastAcountId(0);
$this->setCommonData();
- $this->setShowData();
}
/**
@@ -155,7 +152,7 @@ class Account extends Controller implements ActionsInterface
} elseif (!UserPass::checkUserUpdateMPass(Session::getUserId())) {
$this->showError(self::ERR_UPDATE_MPASS);
return false;
- } elseif ($this->id > 0 && !Acl::checkAccountAccess($this->action, $this->account->getAccountDataForACL())) {
+ } elseif ($this->id > 0 && !Acl::checkAccountAccess($this->getAction(), $this->Account->getAccountDataForACL())) {
$this->showError(self::ERR_ACCOUNT_NO_PERMISSION);
return false;
}
@@ -177,18 +174,18 @@ class Account extends Controller implements ActionsInterface
$this->view->assign('accountTags', $this->getAccount()->getAccountData()->getTags());
$this->view->assign('accountTagsJson', Json::getJson(array_keys($this->getAccount()->getAccountData()->getTags())));
$this->view->assign('changesHash', $this->getAccount()->getAccountModHash());
- $this->view->assign('chkUserEdit', ($this->getAccount()->getAccountData()->getAccountOtherUserEdit()) ? 'checked' : '');
- $this->view->assign('chkGroupEdit', ($this->getAccount()->getAccountData()->getAccountOtherGroupEdit()) ? 'checked' : '');
- $this->view->assign('historyData', \SP\Account\AccountHistory::getAccountList($this->getAccount()->getAccountParentId()));
+ $this->view->assign('chkUserEdit', $this->getAccount()->getAccountData()->getAccountOtherUserEdit() ? 'checked' : '');
+ $this->view->assign('chkGroupEdit', $this->getAccount()->getAccountData()->getAccountOtherGroupEdit() ? 'checked' : '');
+ $this->view->assign('historyData', AccountHistory::getAccountList($this->getAccount()->getAccountParentId()));
$this->view->assign('isModified', ($this->view->accountData->account_dateEdit && $this->view->accountData->account_dateEdit <> '0000-00-00 00:00:00'));
$this->view->assign('maxFileSize', round(Config::getConfig()->getFilesAllowedSize() / 1024, 1));
$this->view->assign('filesAllowedExts', implode(',', Config::getConfig()->getFilesAllowedExts()));
- $this->view->assign('filesDelete', ($this->action == Acl::ACTION_ACC_EDIT) ? 1 : 0);
$publicLinkUrl = (Checks::publicLinksIsEnabled() && isset($this->view->accountData->publicLink_hash)) ? Init::$WEBURI . '/?h=' . $this->view->accountData->publicLink_hash . '&a=link' : '';
$this->view->assign('publicLinkUrl', $publicLinkUrl);
}
+ $this->view->assign('actionId', $this->getAction());
$this->view->assign('accountParentId', Session::getLastAcountId());
$this->view->assign('categories', DBUtil::getValuesForSelect('categories', 'category_id', 'category_name'));
$this->view->assign('customers', DBUtil::getValuesForSelect('customers', 'customer_id', 'customer_name'));
@@ -197,6 +194,11 @@ class Account extends Controller implements ActionsInterface
$this->view->assign('otherGroups', Group::getItem()->getAll());
$this->view->assign('otherGroupsJson', Json::getJson($this->view->otherGroups));
$this->view->assign('tagsJson', Json::getJson(Tag::getItem()->getAll()));
+
+ $AccountAcl = new AccountAcl();
+ $AccountAcl->setModified($this->isGotData() ? $this->view->isModified : false);
+ $AccountAcl->getAcl($this->getAccount(), $this->getAction());
+ $this->view->assign('AccountAcl', $AccountAcl);
}
/**
@@ -219,11 +221,11 @@ class Account extends Controller implements ActionsInterface
}
/**
- * @return \SP\Account\Account|\SP\Account\AccountHistory
+ * @return \SP\Account\Account|AccountHistory
*/
private function getAccount()
{
- return $this->account;
+ return $this->Account ?: new Account();
}
/**
@@ -231,34 +233,40 @@ class Account extends Controller implements ActionsInterface
*/
private function setShowData()
{
- $aclData = ($this->isGotData()) ? $this->account->getAccountDataForACL() : null;
+ $AccountAcl = new AccountAcl();
+ $AccountAcl->setModified($this->view->isModified);
+ $AccountAcl->getAcl($this->Account, $this->action);
- $this->view->assign('showHistory', (($this->action == Acl::ACTION_ACC_VIEW || $this->action == Acl::ACTION_ACC_VIEW_HISTORY)
+ $this->view->assign('AccountAcl', $AccountAcl);
+
+/* $aclData = $this->isGotData() ? $this->Account->getAccountDataForACL() : null;
+
+ $this->view->assign('showHistory', ($this->action === Acl::ACTION_ACC_VIEW || $this->action === Acl::ACTION_ACC_VIEW_HISTORY)
&& Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_HISTORY)
- && ($this->view->isModified || $this->action == Acl::ACTION_ACC_VIEW_HISTORY)));
- $this->view->assign('showDetails', ($this->action == Acl::ACTION_ACC_VIEW || $this->action == Acl::ACTION_ACC_VIEW_HISTORY || $this->action == Acl::ACTION_ACC_DELETE));
- $this->view->assign('showPass', ($this->action == Acl::ACTION_ACC_NEW || $this->action == Acl::ACTION_ACC_COPY));
- $this->view->assign('showFiles', (($this->action == Acl::ACTION_ACC_EDIT || $this->action == Acl::ACTION_ACC_VIEW || $this->action == Acl::ACTION_ACC_VIEW_HISTORY)
- && (Checks::fileIsEnabled() && Acl::checkUserAccess(Acl::ACTION_ACC_FILES))));
- $this->view->assign('showViewPass', (($this->action == Acl::ACTION_ACC_VIEW || $this->action == Acl::ACTION_ACC_VIEW_HISTORY)
+ && ($this->view->isModified || $this->action === Acl::ACTION_ACC_VIEW_HISTORY));
+ $this->view->assign('showDetails', $this->action === Acl::ACTION_ACC_VIEW || $this->action === Acl::ACTION_ACC_VIEW_HISTORY || $this->action === Acl::ACTION_ACC_DELETE);
+ $this->view->assign('showPass', $this->action === Acl::ACTION_ACC_NEW || $this->action === Acl::ACTION_ACC_COPY);
+ $this->view->assign('showFiles', ($this->action === Acl::ACTION_ACC_EDIT || $this->action === Acl::ACTION_ACC_VIEW || $this->action === Acl::ACTION_ACC_VIEW_HISTORY)
+ && (Checks::fileIsEnabled() && Acl::checkUserAccess(Acl::ACTION_ACC_FILES)));
+ $this->view->assign('showViewPass', ($this->action === Acl::ACTION_ACC_VIEW || $this->action === Acl::ACTION_ACC_VIEW_HISTORY)
&& (Acl::checkAccountAccess(Acl::ACTION_ACC_VIEW_PASS, $aclData)
- && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_PASS))));
- $this->view->assign('showSave', ($this->action == Acl::ACTION_ACC_EDIT || $this->action == Acl::ACTION_ACC_NEW || $this->action == Acl::ACTION_ACC_COPY));
- $this->view->assign('showEdit', ($this->action == Acl::ACTION_ACC_VIEW
+ && Acl::checkUserAccess(Acl::ACTION_ACC_VIEW_PASS)));
+ $this->view->assign('showSave', $this->action === Acl::ACTION_ACC_EDIT || $this->action === Acl::ACTION_ACC_NEW || $this->action === Acl::ACTION_ACC_COPY);
+ $this->view->assign('showEdit', $this->action === Acl::ACTION_ACC_VIEW
&& Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT, $aclData)
&& Acl::checkUserAccess(Acl::ACTION_ACC_EDIT)
- && !$this->account->getAccountIsHistory()));
- $this->view->assign('showEditPass', ($this->action == Acl::ACTION_ACC_EDIT || $this->action == Acl::ACTION_ACC_VIEW
+ && !$this->Account->getAccountIsHistory());
+ $this->view->assign('showEditPass', $this->action === Acl::ACTION_ACC_EDIT || $this->action === Acl::ACTION_ACC_VIEW
&& Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT_PASS, $aclData)
&& Acl::checkUserAccess(Acl::ACTION_ACC_EDIT_PASS)
- && !$this->account->getAccountIsHistory()));
- $this->view->assign('showDelete', ($this->action == Acl::ACTION_ACC_DELETE || $this->action == Acl::ACTION_ACC_EDIT
+ && !$this->Account->getAccountIsHistory());
+ $this->view->assign('showDelete', $this->action === Acl::ACTION_ACC_DELETE || $this->action === Acl::ACTION_ACC_EDIT
&& Acl::checkAccountAccess(Acl::ACTION_ACC_DELETE, $aclData)
- && Acl::checkUserAccess(Acl::ACTION_ACC_DELETE)));
- $this->view->assign('showRestore', ($this->action == Acl::ACTION_ACC_VIEW_HISTORY
- && Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT, $this->account->getAccountDataForACL($this->account->getAccountParentId()))
- && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT)));
- $this->view->assign('showLink', Checks::publicLinksIsEnabled() && Acl::checkUserAccess(Acl::ACTION_MGM_PUBLICLINKS));
+ && Acl::checkUserAccess(Acl::ACTION_ACC_DELETE));
+ $this->view->assign('showRestore', $this->action === Acl::ACTION_ACC_VIEW_HISTORY
+ && Acl::checkAccountAccess(Acl::ACTION_ACC_EDIT, $this->Account->getAccountDataForACL($this->Account->getAccountParentId()))
+ && Acl::checkUserAccess(Acl::ACTION_ACC_EDIT));
+ $this->view->assign('showLink', Checks::publicLinksIsEnabled() && Acl::checkUserAccess(Acl::ACTION_MGM_PUBLICLINKS));*/
}
/**
@@ -277,16 +285,15 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account');
$this->view->assign('title',
- array(
+ [
'class' => 'titleGreen',
'name' => _('Copiar Cuenta'),
'icon' => $this->icons->getIconCopy()->getIcon()
- )
+ ]
);
$this->view->assign('nextaction', self::ACTION_ACC_COPY);
$this->setCommonData();
- $this->setShowData();
}
/**
@@ -297,8 +304,8 @@ class Account extends Controller implements ActionsInterface
private function setAccountData()
{
try {
- $this->setAccount(new \SP\Account\Account(new AccountData($this->getId())));
- $this->account->setAccountParentId($this->getId());
+ $this->setAccount(new Account(new AccountData($this->getId())));
+ $this->Account->setAccountParentId($this->getId());
$this->view->assign('accountId', $this->getId());
$this->view->assign('accountData', $this->getAccount()->getData());
@@ -314,11 +321,11 @@ class Account extends Controller implements ActionsInterface
}
/**
- * @param \SP\Account\Account|\SP\Account\AccountHistory $account
+ * @param \SP\Account\Account|AccountHistory $account
*/
private function setAccount($account)
{
- $this->account = $account;
+ $this->Account = $account;
}
/**
@@ -345,16 +352,15 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account');
$this->view->assign('title',
- array(
+ [
'class' => 'titleOrange',
'name' => _('Editar Cuenta'),
'icon' => $this->icons->getIconEdit()->getIcon()
- )
+ ]
);
$this->view->assign('nextaction', self::ACTION_ACC_VIEW);
$this->setCommonData();
- $this->setShowData();
}
/**
@@ -373,15 +379,14 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account');
$this->view->assign('title',
- array(
+ [
'class' => 'titleRed',
'name' => _('Eliminar Cuenta'),
'icon' => $this->icons->getIconDelete()->getIcon()
- )
+ ]
);
$this->setCommonData();
- $this->setShowData();
}
/**
@@ -400,20 +405,19 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account');
$this->view->assign('title',
- array(
+ [
'class' => 'titleNormal',
'name' => _('Detalles de Cuenta'),
'icon' => $this->icons->getIconView()->getIcon()
- )
+ ]
);
$this->view->assign('isView', true);
- \SP\Core\Session::setAccountParentId($this->getId());
- $this->account->incrementViewCounter();
+ Session::setAccountParentId($this->getId());
+ $this->Account->incrementViewCounter();
$this->setCommonData();
- $this->setShowData();
}
/**
@@ -432,18 +436,17 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account');
$this->view->assign('title',
- array(
+ [
'class' => 'titleNormal',
'name' => _('Detalles de Cuenta'),
'icon' => 'access_time'
- )
+ ]
);
$this->view->assign('isView', true);
- $this->account->setAccountIsHistory(1);
+ $this->Account->setAccountIsHistory(1);
$this->setCommonData();
- $this->setShowData();
}
/**
@@ -454,8 +457,8 @@ class Account extends Controller implements ActionsInterface
private function setAccountDataHistory()
{
try {
- $this->setAccount(new \SP\Account\AccountHistory(new AccountData($this->getId())));
- $this->account->setAccountParentId(Session::getAccountParentId());
+ $this->setAccount(new AccountHistory(new AccountData($this->getId())));
+ $this->Account->setAccountParentId(Session::getAccountParentId());
$this->view->assign('accountId', $this->getId());
$this->view->assign('accountData', $this->getAccount()->getData());
@@ -487,11 +490,11 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account-editpass');
$this->view->assign('title',
- array(
+ [
'class' => 'titleOrange',
'name' => _('Modificar Clave de Cuenta'),
'icon' => $this->icons->getIconEditPass()->getIcon()
- )
+ ]
);
$this->view->assign('nextaction', self::ACTION_ACC_VIEW);
}
@@ -524,20 +527,20 @@ class Account extends Controller implements ActionsInterface
$this->view->addTemplate('account-link');
$this->view->assign('title',
- array(
+ [
'class' => 'titleNormal',
'name' => _('Detalles de Cuenta'),
'icon' => $this->icons->getIconView()->getIcon()
- )
+ ]
);
- $this->account->incrementViewCounter();
- $this->account->incrementDecryptCounter();
- $this->account->getAccountPassData();
+ $this->Account->incrementViewCounter();
+ $this->Account->incrementDecryptCounter();
+ $this->Account->getAccountPassData();
// Desencriptar la clave de la cuenta
$pass = Crypt::generateAesKey($PublicLink->getItemData()->getLinkHash());
$masterPass = Crypt::getDecrypt($PublicLink->getItemData()->getPass(), $PublicLink->getItemData()->getPassIV(), $pass);
- $accountPass = Crypt::getDecrypt($this->account->getAccountData()->getAccountPass(), $this->account->getAccountData()->getAccountIV(), $masterPass);
+ $accountPass = Crypt::getDecrypt($this->Account->getAccountData()->getAccountPass(), $this->Account->getAccountData()->getAccountIV(), $masterPass);
if (Config::getConfig()->isPublinksImageEnabled()) {
$accountPass = ImageUtil::convertText($accountPass);
diff --git a/inc/SP/Controller/AccountsSearch.class.php b/inc/SP/Controller/AccountSearchController.class.php
similarity index 81%
rename from inc/SP/Controller/AccountsSearch.class.php
rename to inc/SP/Controller/AccountSearchController.class.php
index 3338126a..08401b0f 100644
--- a/inc/SP/Controller/AccountsSearch.class.php
+++ b/inc/SP/Controller/AccountSearchController.class.php
@@ -36,6 +36,7 @@ use SP\Core\SessionUtil;
use SP\Core\Template;
use SP\Html\DataGrid\DataGrid;
use SP\Html\DataGrid\DataGridAction;
+use SP\Html\DataGrid\DataGridActionSearch;
use SP\Html\DataGrid\DataGridActionType;
use SP\Html\DataGrid\DataGridData;
use SP\Html\DataGrid\DataGridHeaderSort;
@@ -50,7 +51,7 @@ use SP\Util\Checks;
*
* @package Controller
*/
-class AccountsSearch extends Controller implements ActionsInterface
+class AccountSearchController extends ControllerBase implements ActionsInterface
{
/**
* Indica si el filtrado de cuentas está activo
@@ -97,7 +98,7 @@ class AccountsSearch extends Controller implements ActionsInterface
*/
private function setVars()
{
- $this->view->assign('isAdmin', (Session::getUserIsAdminApp() || Session::getUserIsAdminAcc()));
+ $this->view->assign('isAdmin', Session::getUserIsAdminApp() || Session::getUserIsAdminAcc());
$this->view->assign('showGlobalSearch', Config::getConfig()->isGlobalSearch());
// Comprobar si está creado el objeto de búsqueda en la sesión
@@ -112,16 +113,16 @@ class AccountsSearch extends Controller implements ActionsInterface
// de lo contrario, se recupera la información de filtros de la sesión
$isSearch = (!isset($this->view->actionId));
- $this->sortKey = ($isSearch) ? Request::analyze('skey', 0) : $filters->getSortKey();
- $this->sortOrder = ($isSearch) ? Request::analyze('sorder', 0) : $filters->getSortOrder();
- $this->searchGlobal = ($isSearch) ? Request::analyze('gsearch', 0) : $filters->getGlobalSearch();
- $this->limitStart = ($isSearch) ? Request::analyze('start', 0) : $filters->getLimitStart();
- $this->limitCount = ($isSearch) ? Request::analyze('rpp', 0) : $filters->getLimitCount();
+ $this->sortKey = $isSearch ? Request::analyze('skey', 0) : $filters->getSortKey();
+ $this->sortOrder = $isSearch ? Request::analyze('sorder', 0) : $filters->getSortOrder();
+ $this->searchGlobal = $isSearch ? Request::analyze('gsearch', 0) : $filters->getGlobalSearch();
+ $this->limitStart = $isSearch ? Request::analyze('start', 0) : $filters->getLimitStart();
+ $this->limitCount = $isSearch ? Request::analyze('rpp', 0) : $filters->getLimitCount();
// Valores POST
- $this->view->assign('searchCustomer', ($isSearch) ? Request::analyze('customer', 0) : $filters->getCustomerId());
- $this->view->assign('searchCategory', ($isSearch) ? Request::analyze('category', 0) : $filters->getCategoryId());
- $this->view->assign('searchTxt', ($isSearch) ? Request::analyze('search') : $filters->getTxtSearch());
+ $this->view->assign('searchCustomer', $isSearch ? Request::analyze('customer', 0) : $filters->getCustomerId());
+ $this->view->assign('searchCategory', $isSearch ? Request::analyze('category', 0) : $filters->getCategoryId());
+ $this->view->assign('searchTxt', $isSearch ? Request::analyze('search') : $filters->getTxtSearch());
$this->view->assign('searchGlobal', Request::analyze('gsearch', $filters->getGlobalSearch()));
$this->view->assign('searchFavorites', Request::analyze('searchfav', $filters->isSearchFavorites()));
}
@@ -150,7 +151,7 @@ class AccountsSearch extends Controller implements ActionsInterface
*/
public function getSearch()
{
- $this->view->addTemplate('datasearch-grid');
+ $this->view->addTemplate('index');
$this->view->assign('isAjax', $this->isAjax);
@@ -213,10 +214,9 @@ class AccountsSearch extends Controller implements ActionsInterface
->setTitle(_('Detalles de Cuenta'))
->setIcon($this->icons->getIconView())
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowView')
- ->setOnClickFunction('sysPassUtil.Common.accGridAction')
- ->setOnClickArgs(self::ACTION_ACC_VIEW)
- ->setOnClickArgs(self::ACTION_ACC_SEARCH)
- ->setOnClickArgs('this');
+ ->addData('action-id', self::ACTION_ACC_VIEW)
+ ->addData('action-sk', $this->sk)
+ ->addData('onclick', 'account/show');
$GridActionViewPass = new DataGridAction();
$GridActionViewPass->setId(self::ACTION_ACC_VIEW_PASS)
@@ -225,9 +225,9 @@ class AccountsSearch extends Controller implements ActionsInterface
->setTitle(_('Ver Clave'))
->setIcon($this->icons->getIconViewPass())
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowViewPass')
- ->setOnClickFunction('sysPassUtil.Common.accGridViewPass')
- ->setOnClickArgs('this')
- ->setOnClickArgs(1);
+ ->addData('action-id', self::ACTION_ACC_VIEW_PASS)
+ ->addData('action-sk', $this->sk)
+ ->addData('onclick', 'account/showpass');
// Añadir la clase para usar el portapapeles
$ClipboardIcon = $this->icons->getIconClipboard()->setClass('clip-pass-button');
@@ -239,9 +239,9 @@ class AccountsSearch extends Controller implements ActionsInterface
->setTitle(_('Copiar Clave en Portapapeles'))
->setIcon($ClipboardIcon)
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopyPass')
- ->setOnClickFunction('sysPassUtil.Common.accGridViewPass')
- ->setOnClickArgs('this')
- ->setOnClickArgs(0);
+ ->addData('action-id', self::ACTION_ACC_VIEW_PASS)
+ ->addData('action-sk', $this->sk)
+ ->addData('useclipboard', '1');
$EditIcon = $this->icons->getIconEdit();
@@ -256,10 +256,9 @@ class AccountsSearch extends Controller implements ActionsInterface
->setTitle(_('Editar Cuenta'))
->setIcon($EditIcon)
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowEdit')
- ->setOnClickFunction('sysPassUtil.Common.accGridAction')
- ->setOnClickArgs(self::ACTION_ACC_EDIT)
- ->setOnClickArgs(self::ACTION_ACC_SEARCH)
- ->setOnClickArgs('this');
+ ->addData('action-id', self::ACTION_ACC_EDIT)
+ ->addData('action-sk', $this->sk)
+ ->addData('onclick', 'account/edit');
$CopyIcon = $this->icons->getIconCopy();
@@ -274,10 +273,9 @@ class AccountsSearch extends Controller implements ActionsInterface
->setTitle(_('Copiar Cuenta'))
->setIcon($CopyIcon)
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopy')
- ->setOnClickFunction('sysPassUtil.Common.accGridAction')
- ->setOnClickArgs(self::ACTION_ACC_COPY)
- ->setOnClickArgs(self::ACTION_ACC_SEARCH)
- ->setOnClickArgs('this');
+ ->addData('action-id', self::ACTION_ACC_COPY)
+ ->addData('action-sk', $this->sk)
+ ->addData('onclick', 'account/copy');
$DeleteIcon = $this->icons->getIconDelete();
@@ -292,10 +290,9 @@ class AccountsSearch extends Controller implements ActionsInterface
->setTitle(_('Eliminar Cuenta'))
->setIcon($DeleteIcon)
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowDelete')
- ->setOnClickFunction('sysPassUtil.Common.accGridAction')
- ->setOnClickArgs(self::ACTION_ACC_DELETE)
- ->setOnClickArgs(self::ACTION_ACC_SEARCH)
- ->setOnClickArgs('this');
+ ->addData('action-id', self::ACTION_ACC_DELETE)
+ ->addData('action-sk', $this->sk)
+ ->addData('onclick', 'account/delete');
$GridActionRequest = new DataGridAction();
$GridActionRequest->setId(self::ACTION_ACC_REQUEST)
@@ -303,19 +300,17 @@ class AccountsSearch extends Controller implements ActionsInterface
->setTitle(_('Solicitar Modificación'))
->setIcon($this->icons->getIconEmail())
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowRequest')
- ->setOnClickFunction('sysPassUtil.Common.accGridAction')
- ->setOnClickArgs(self::ACTION_ACC_REQUEST)
- ->setOnClickArgs(self::ACTION_ACC_SEARCH)
- ->setOnClickArgs('this');
+ ->addData('action-id', self::ACTION_ACC_REQUEST)
+ ->addData('action-sk', $this->sk)
+ ->addData('onclick', 'account/request');
$GridActionOptional = new DataGridAction();
- $GridActionOptional->setId(self::ACTION_ACC_REQUEST)
+ $GridActionOptional->setId(0)
->setName(_('Más Acciones'))
->setTitle(_('Más Acciones'))
->setIcon($this->icons->getIconOptional())
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowOptional')
- ->setOnClickFunction('sysPassUtil.Common.showOptional')
- ->setOnClickArgs('this');
+ ->addData('onclick', 'account/menu');
$GridPager = new DataGridPager();
$GridPager->setIconPrev($this->icons->getIconNavPrev())
@@ -326,16 +321,17 @@ class AccountsSearch extends Controller implements ActionsInterface
->setSortOrder($this->sortOrder)
->setLimitStart($this->limitStart)
->setLimitCount($this->limitCount)
- ->setOnClickFunction('sysPassUtil.Common.searchSort')
+ ->setOnClickFunction('account/sort')
->setOnClickArgs($this->sortKey)
->setOnClickArgs($this->sortOrder)
- ->setFilterOn($this->filterOn);
+ ->setFilterOn($this->filterOn)
+ ->setSourceAction(new DataGridActionSearch(self::ACTION_ACC_SEARCH));
$Grid = new DataGrid();
$Grid->setId('gridSearch')
- ->setDataHeaderTemplate('datasearch-header')
- ->setDataRowTemplate('datasearch-rows')
- ->setDataPagerTemplate('datagrid-nav-full')
+ ->setDataHeaderTemplate('header', $this->view->getBase())
+ ->setDataRowTemplate('rows', $this->view->getBase())
+ ->setDataPagerTemplate('datagrid-nav-full', 'grid')
->setHeader($this->getHeaderSort())
->setDataActions($GridActionView)
->setDataActions($GridActionViewPass)
diff --git a/inc/SP/Controller/AppItemMgmt.class.php b/inc/SP/Controller/AppItemController.class.php
similarity index 98%
rename from inc/SP/Controller/AppItemMgmt.class.php
rename to inc/SP/Controller/AppItemController.class.php
index d8e48acb..ba7f64c6 100644
--- a/inc/SP/Controller/AppItemMgmt.class.php
+++ b/inc/SP/Controller/AppItemController.class.php
@@ -52,7 +52,7 @@ use SP\Util\Util;
*
* @package Controller
*/
-class AppItemMgmt extends Controller implements ActionsInterface
+class AppItemController extends ControllerBase implements ActionsInterface
{
/**
* @var int
diff --git a/inc/SP/Controller/AppItemsMgmt.class.php b/inc/SP/Controller/AppItemsController.class.php
similarity index 96%
rename from inc/SP/Controller/AppItemsMgmt.class.php
rename to inc/SP/Controller/AppItemsController.class.php
index a6398c4d..55d07aa0 100644
--- a/inc/SP/Controller/AppItemsMgmt.class.php
+++ b/inc/SP/Controller/AppItemsController.class.php
@@ -51,7 +51,7 @@ use SP\Mgmt\Tags\TagSearch;
*
* @package Controller
*/
-class AppItemsMgmt extends GridTabController implements ActionsInterface
+class AppItemsController extends GridTabControllerBase implements ActionsInterface
{
/**
* @var ItemSearchData
@@ -117,6 +117,8 @@ class AppItemsMgmt extends GridTabController implements ActionsInterface
{
$this->setAction(self::ACTION_ACC_FILES);
+ $this->view->addTemplate('files', 'appitem');
+
$this->view->assign('accountId', Request::analyze('id', 0));
$this->view->assign('deleteEnabled', Request::analyze('del', 0));
$this->view->assign('files', FileUtil::getAccountFiles($this->view->accountId));
@@ -124,10 +126,6 @@ class AppItemsMgmt extends GridTabController implements ActionsInterface
if (!is_array($this->view->files) || count($this->view->files) === 0) {
return;
}
-
- $this->view->addTemplate('files');
-
- $this->view->assign('sk', SessionUtil::getSessionKey());
}
/**
diff --git a/inc/SP/Controller/AppItemsMgmtSearch.class.php b/inc/SP/Controller/AppItemsSearchController.class.php
similarity index 92%
rename from inc/SP/Controller/AppItemsMgmtSearch.class.php
rename to inc/SP/Controller/AppItemsSearchController.class.php
index 264b9702..ec473f2e 100644
--- a/inc/SP/Controller/AppItemsMgmtSearch.class.php
+++ b/inc/SP/Controller/AppItemsSearchController.class.php
@@ -45,7 +45,7 @@ use SP\Mgmt\Tags\TagSearch;
*
* @package SP\Controller
*/
-class AppItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
+class AppItemsSearchController extends GridItemsSearchController implements ActionsInterface
{
/**
* Obtener las cuentas de una búsqueda
@@ -60,7 +60,7 @@ class AppItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getAccountsGrid();
$Grid->getData()->setData(AccountUtil::getAccountsMgmtSearch($SearchData));
@@ -85,7 +85,7 @@ class AppItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getFilesGrid();
$Grid->getData()->setData(FileSearch::getItem()->getMgmtSearch($SearchData));
@@ -110,7 +110,7 @@ class AppItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getCustomFieldsGrid();
$Grid->getData()->setData(CustomFieldDefSearch::getItem()->getMgmtSearch($SearchData));
@@ -135,7 +135,7 @@ class AppItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getCustomersGrid();
$Grid->getData()->setData(CustomerSearch::getItem()->getMgmtSearch($SearchData));
@@ -160,7 +160,7 @@ class AppItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getCategoriesGrid();
$Grid->getData()->setData(CategorySearch::getItem()->getMgmtSearch($SearchData));
@@ -185,7 +185,7 @@ class AppItemsMgmtSearch extends GridItemsSearch implements ActionsInterface
return;
}
- $this->view->addTemplate('datagrid-rows');
+ $this->view->addTemplate('datagrid-rows', 'grid');
$Grid = $this->_grids->getTagsGrid();
$Grid->getData()->setData(TagSearch::getItem()->getMgmtSearch($SearchData));
diff --git a/inc/SP/Controller/ConfigMgmt.class.php b/inc/SP/Controller/ConfigController.class.php
similarity index 69%
rename from inc/SP/Controller/ConfigMgmt.class.php
rename to inc/SP/Controller/ConfigController.class.php
index 5afac337..6942497d 100644
--- a/inc/SP/Controller/ConfigMgmt.class.php
+++ b/inc/SP/Controller/ConfigController.class.php
@@ -34,7 +34,8 @@ use SP\Core\Init;
use SP\Core\Language;
use SP\Core\Session;
use SP\Core\SessionUtil;
-use SP\Core\Themes;
+use SP\Core\DiFactory;
+use SP\Core\Template;
use SP\Storage\DBUtil;
use SP\Util\Checks;
use SP\Util\Util;
@@ -44,7 +45,7 @@ use SP\Util\Util;
*
* @package Controller
*/
-class ConfigMgmt extends Controller implements ActionsInterface
+class ConfigController extends ControllerBase implements ActionsInterface
{
private $tabIndex = 0;
private $Config;
@@ -52,17 +53,17 @@ class ConfigMgmt extends Controller implements ActionsInterface
/**
* Constructor
*
- * @param $template \SP\Core\Template con instancia de plantilla
+ * @param $template Template con instancia de plantilla
*/
- public function __construct(\SP\Core\Template $template = null)
+ public function __construct(Template $template = null)
{
parent::__construct($template);
$this->Config = Config::getConfig();
- $this->view->assign('tabs', array());
+ $this->view->assign('tabs', []);
$this->view->assign('sk', SessionUtil::getSessionKey(true));
- $this->view->assign('isDemoMode', (Checks::demoIsEnabled() && !Session::getUserIsAdminApp()));
+ $this->view->assign('isDemoMode', Checks::demoIsEnabled() && !Session::getUserIsAdminApp());
$this->view->assign('isDisabled', (Checks::demoIsEnabled() && !Session::getUserIsAdminApp()) ? 'DISABLED' : '');
}
@@ -79,56 +80,69 @@ class ConfigMgmt extends Controller implements ActionsInterface
return;
}
- $this->view->addTemplate('config');
+ $this->view->addTemplate('general');
- $this->view->assign('langsAvailable',Language::getAvailableLanguages());
+ $this->view->assign('langsAvailable', Language::getAvailableLanguages());
$this->view->assign('currentLang', $this->Config->getSiteLang());
- $this->view->assign('themesAvailable', Themes::getThemesAvailable());
+ $this->view->assign('themesAvailable', DiFactory::getTheme()->getThemesAvailable());
$this->view->assign('currentTheme', $this->Config->getSiteTheme());
- $this->view->assign('chkHttps', ($this->Config->isHttpsEnabled()) ? 'checked="checked"' : '');
- $this->view->assign('chkDebug', ($this->Config->isDebug()) ? 'checked="checked"' : '');
- $this->view->assign('chkMaintenance', ($this->Config->isMaintenance()) ? 'checked="checked"' : '');
- $this->view->assign('chkUpdates', ($this->Config->isCheckUpdates()) ? 'checked="checked"' : '');
- $this->view->assign('chkNotices', ($this->Config->isChecknotices()) ? 'checked="checked"' : '');
+ $this->view->assign('chkHttps', $this->Config->isHttpsEnabled() ? 'checked="checked"' : '');
+ $this->view->assign('chkDebug', $this->Config->isDebug() ? 'checked="checked"' : '');
+ $this->view->assign('chkMaintenance', $this->Config->isMaintenance() ? 'checked="checked"' : '');
+ $this->view->assign('chkUpdates', $this->Config->isCheckUpdates() ? 'checked="checked"' : '');
+ $this->view->assign('chkNotices', $this->Config->isChecknotices() ? 'checked="checked"' : '');
$this->view->assign('sessionTimeout', $this->Config->getSessionTimeout());
// Events
- $this->view->assign('chkLog', ($this->Config->isLogEnabled()) ? 'checked="checked"' : '');
- $this->view->assign('chkSyslog', ($this->Config->isSyslogEnabled()) ? 'checked="checked"' : '');
- $this->view->assign('chkRemoteSyslog', ($this->Config->isSyslogRemoteEnabled()) ? 'checked="checked"' : '');
+ $this->view->assign('chkLog', $this->Config->isLogEnabled() ? 'checked="checked"' : '');
+ $this->view->assign('chkSyslog', $this->Config->isSyslogEnabled() ? 'checked="checked"' : '');
+ $this->view->assign('chkRemoteSyslog', $this->Config->isSyslogRemoteEnabled() ? 'checked="checked"' : '');
$this->view->assign('remoteSyslogServer', $this->Config->getSyslogServer());
$this->view->assign('remoteSyslogPort', $this->Config->getSyslogPort());
// Files
- $this->view->assign('chkFiles', ($this->Config->isFilesEnabled()) ? 'checked="checked"' : '');
+ $this->view->assign('chkFiles', $this->Config->isFilesEnabled() ? 'checked="checked"' : '');
$this->view->assign('filesAllowedExts', implode(',', $this->Config->getFilesAllowedExts()));
$this->view->assign('filesAllowedSize', $this->Config->getFilesAllowedSize());
// Accounts
- $this->view->assign('chkGlobalSearch', ($this->Config->isGlobalSearch()) ? 'checked="checked"' : '');
- $this->view->assign('chkResultsAsCards', ($this->Config->isResultsAsCards()) ? 'checked="checked"' : '');
- $this->view->assign('chkAccountPassToImage', ($this->Config->isAccountPassToImage()) ? 'checked="checked"' : '');
- $this->view->assign('chkAccountLink', ($this->Config->isAccountLink()) ? 'checked="checked"' : '');
+ $this->view->assign('chkGlobalSearch', $this->Config->isGlobalSearch() ? 'checked="checked"' : '');
+ $this->view->assign('chkResultsAsCards', $this->Config->isResultsAsCards() ? 'checked="checked"' : '');
+ $this->view->assign('chkAccountPassToImage', $this->Config->isAccountPassToImage() ? 'checked="checked"' : '');
+ $this->view->assign('chkAccountLink', $this->Config->isAccountLink() ? 'checked="checked"' : '');
$this->view->assign('accountCount', $this->Config->getAccountCount());
// PublicLinks
- $this->view->assign('chkPubLinks', ($this->Config->isPublinksImageEnabled()) ? 'checked="checked"' : '');
- $this->view->assign('chkPubLinksImage', ($this->Config->isPublinksImageEnabled()) ? 'checked="checked"' : '');
+ $this->view->assign('chkPubLinks', $this->Config->isPublinksImageEnabled() ? 'checked="checked"' : '');
+ $this->view->assign('chkPubLinksImage', $this->Config->isPublinksImageEnabled() ? 'checked="checked"' : '');
$this->view->assign('pubLinksMaxTime', $this->Config->getPublinksMaxTime() / 60);
$this->view->assign('pubLinksMaxViews', $this->Config->getPublinksMaxViews());
// Proxy
- $this->view->assign('chkProxy', ($this->Config->isProxyEnabled()) ? 'checked="checked"' : '');
+ $this->view->assign('chkProxy', $this->Config->isProxyEnabled() ? 'checked="checked"' : '');
$this->view->assign('proxyServer', $this->Config->getProxyServer());
$this->view->assign('proxyPort', $this->Config->getProxyPort());
$this->view->assign('proxyUser', $this->Config->getProxyUser());
$this->view->assign('proxyPass', $this->Config->getProxyPass());
$this->view->assign('actionId', $this->getAction(), 'config');
- $this->view->append('tabs', array('title' => _('General')));
+ $this->view->append('tabs', ['title' => _('General')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'config');
}
+ /**
+ * Obtener el índice actual de las pestañas
+ *
+ * @return int
+ */
+ private function getTabIndex()
+ {
+ $index = $this->tabIndex;
+ $this->tabIndex++;
+
+ return $index;
+ }
+
/**
* Obtener la pestaña de encriptación
*
@@ -144,12 +158,12 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->addTemplate('encryption');
- $this->view->assign('lastUpdateMPass', ConfigDB::getValue("lastupdatempass"));
- $this->view->assign('tempMasterPassTime', ConfigDB::getValue("tempmaster_passtime"));
- $this->view->assign('tempMasterMaxTime', ConfigDB::getValue("tempmaster_maxtime"));
+ $this->view->assign('lastUpdateMPass', ConfigDB::getValue('lastupdatempass'));
+ $this->view->assign('tempMasterPassTime', ConfigDB::getValue('tempmaster_passtime'));
+ $this->view->assign('tempMasterMaxTime', ConfigDB::getValue('tempmaster_maxtime'));
$this->view->assign('tempMasterPass', Session::getTemporaryMasterPass());
- $this->view->append('tabs', array('title' => _('Encriptación')));
+ $this->view->append('tabs', ['title' => _('Encriptación')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'encryption');
}
@@ -172,11 +186,11 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->assign('backupDir', Init::$SERVERROOT . '/backup');
$this->view->assign('backupPath', Init::$WEBROOT . '/backup');
- $backupHash = $this->Config->getBackupHash();
- $exportHash = $this->Config->getExportHash();
+ $backupHash = $this->Config->getBackupHash();
+ $exportHash = $this->Config->getExportHash();
$this->view->assign('backupFile',
- array('absolute' => $this->view->backupDir . DIRECTORY_SEPARATOR . $this->view->siteName . '-' . $backupHash . '.tar.gz',
+ array('absolute' => $this->view->backupDir . DIRECTORY_SEPARATOR . $this->view->siteName . '-' . $backupHash . '.tar.gz',
'relative' => $this->view->backupPath . '/' . $this->view->siteName . '-' . $backupHash . '.tar.gz',
'filename' => $this->view->siteName . '-' . $backupHash . '.tar.gz')
);
@@ -185,16 +199,16 @@ class ConfigMgmt extends Controller implements ActionsInterface
'relative' => $this->view->backupPath . '/' . $this->view->siteName . 'db-' . $backupHash . '.sql',
'filename' => $this->view->siteName . 'db-' . $backupHash . '.sql')
);
- $this->view->assign('lastBackupTime', (file_exists($this->view->backupFile['absolute'])) ? _('Último backup') . ": " . date("r", filemtime($this->view->backupFile['absolute'])) : _('No se encontraron backups'));
+ $this->view->assign('lastBackupTime', file_exists($this->view->backupFile['absolute']) ? _('Último backup') . ': ' . date('r', filemtime($this->view->backupFile['absolute'])) : _('No se encontraron backups'));
$this->view->assign('exportFile',
array('absolute' => $this->view->backupDir . DIRECTORY_SEPARATOR . $this->view->siteName . '-' . $exportHash . '.xml',
'relative' => $this->view->backupPath . '/' . $this->view->siteName . '-' . $exportHash . '.xml',
'filename' => $this->view->siteName . '-' . $exportHash . '.xml')
);
- $this->view->assign('lastExportTime', (file_exists($this->view->exportFile['absolute'])) ? _('Última exportación') . ': ' . date("r", filemtime($this->view->exportFile['absolute'])) : _('No se encontró archivo de exportación'));
+ $this->view->assign('lastExportTime', file_exists($this->view->exportFile['absolute']) ? _('Última exportación') . ': ' . date('r', filemtime($this->view->exportFile['absolute'])) : _('No se encontró archivo de exportación'));
- $this->view->append('tabs', array('title' => _('Copia de Seguridad')));
+ $this->view->append('tabs', ['title' => _('Copia de Seguridad')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'backup');
}
@@ -216,12 +230,13 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->assign('groups', DBUtil::getValuesForSelect('usrGroups', 'usergroup_id', 'usergroup_name'));
$this->view->assign('users', DBUtil::getValuesForSelect('usrData', 'user_id', 'user_name'));
- $this->view->append('tabs', array('title' => _('Importar Cuentas')));
+ $this->view->append('tabs', ['title' => _('Importar Cuentas')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'import');
}
/**
* Obtener la pestaña de información
+ *
* @return bool
*/
public function getInfoTab()
@@ -236,14 +251,15 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->assign('dbInfo', DBUtil::getDBinfo());
$this->view->assign('dbName', $this->Config->getDbName() . '@' . $this->Config->getDbHost());
- $this->view->assign('configBackupDate', date("r", ConfigDB::getValue('config_backupdate')));
+ $this->view->assign('configBackupDate', date('r', ConfigDB::getValue('config_backupdate')));
- $this->view->append('tabs', array('title' => _('Información')));
+ $this->view->append('tabs', ['title' => _('Información')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'info');
}
/**
* Obtener la pestaña de Wiki
+ *
* @return bool
*/
public function getWikiTab()
@@ -256,12 +272,12 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->addTemplate('wiki');
- $this->view->assign('chkWiki', ($this->Config->isWikiEnabled()) ? 'checked="checked"' : '');
+ $this->view->assign('chkWiki', $this->Config->isWikiEnabled() ? 'checked="checked"' : '');
$this->view->assign('wikiSearchUrl', $this->Config->getWikiSearchurl());
$this->view->assign('wikiPageUrl', $this->Config->getWikiPageurl());
$this->view->assign('wikiFilter', implode(',', $this->Config->getWikiFilter()));
- $this->view->assign('chkDokuWiki', ($this->Config->isDokuwikiEnabled()) ? 'checked="checked"' : '');
+ $this->view->assign('chkDokuWiki', $this->Config->isDokuwikiEnabled() ? 'checked="checked"' : '');
$this->view->assign('dokuWikiUrl', $this->Config->getDokuwikiUrl());
$this->view->assign('dokuWikiUrlBase', $this->Config->getDokuwikiUrlBase());
$this->view->assign('dokuWikiUser', $this->Config->getDokuwikiUser());
@@ -269,12 +285,13 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->assign('dokuWikiNamespace', $this->Config->getDokuwikiNamespace());
$this->view->assign('actionId', $this->getAction(), 'wiki');
- $this->view->append('tabs', array('title' => _('Wiki')));
+ $this->view->append('tabs', ['title' => _('Wiki')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'wiki');
}
/**
* Obtener la pestaña de LDAP
+ *
* @return bool
*/
public function getLdapTab()
@@ -287,8 +304,8 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->addTemplate('ldap');
- $this->view->assign('chkLdap', ($this->Config->isLdapEnabled()) ? 'checked="checked"' : '');
- $this->view->assign('chkLdapADS', ($this->Config->isLdapAds()) ? 'checked="checked"' : '');
+ $this->view->assign('chkLdap', $this->Config->isLdapEnabled() ? 'checked="checked"' : '');
+ $this->view->assign('chkLdapADS', $this->Config->isLdapAds() ? 'checked="checked"' : '');
$this->view->assign('ldapIsAvailable', Checks::ldapIsAvailable());
$this->view->assign('ldapServer', $this->Config->getLdapServer());
$this->view->assign('ldapBindUser', $this->Config->getLdapBindUser());
@@ -301,12 +318,13 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->assign('ldapDefaultProfile', $this->Config->getLdapDefaultProfile());
$this->view->assign('actionId', $this->getAction(), 'ldap');
- $this->view->append('tabs', array('title' => _('LDAP')));
+ $this->view->append('tabs', ['title' => _('LDAP')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'ldap');
}
/**
* Obtener la pestaña de Correo
+ *
* @return bool
*/
public function getMailTab()
@@ -319,9 +337,9 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->addTemplate('mail');
- $this->view->assign('chkMail', ($this->Config->isMailEnabled()) ? 'checked="checked"' : '');
- $this->view->assign('chkMailRequests', ($this->Config->isMailRequestsEnabled()) ? 'checked="checked"' : '');
- $this->view->assign('chkMailAuth', ($this->Config->isMailAuthenabled()) ? 'checked="checked"' : '');
+ $this->view->assign('chkMail', $this->Config->isMailEnabled() ? 'checked="checked"' : '');
+ $this->view->assign('chkMailRequests', $this->Config->isMailRequestsEnabled() ? 'checked="checked"' : '');
+ $this->view->assign('chkMailAuth', $this->Config->isMailAuthenabled() ? 'checked="checked"' : '');
$this->view->assign('mailServer', $this->Config->getMailServer());
$this->view->assign('mailPort', $this->Config->getMailPort());
$this->view->assign('mailUser', $this->Config->getMailUser());
@@ -331,19 +349,7 @@ class ConfigMgmt extends Controller implements ActionsInterface
$this->view->assign('mailSecurity', ['SSL', 'TLS']);
$this->view->assign('actionId', $this->getAction(), 'mail');
- $this->view->append('tabs', array('title' => _('Correo')));
+ $this->view->append('tabs', ['title' => _('Correo')]);
$this->view->assign('tabIndex', $this->getTabIndex(), 'mail');
}
-
- /**
- * Obtener el índice actual de las pestañas
- *
- * @return int
- */
- private function getTabIndex(){
- $index = $this->tabIndex;
- $this->tabIndex++;
-
- return $index;
- }
}
diff --git a/inc/SP/Controller/Controller.class.php b/inc/SP/Controller/ControllerBase.class.php
similarity index 83%
rename from inc/SP/Controller/Controller.class.php
rename to inc/SP/Controller/ControllerBase.class.php
index 4dfe0459..61bb9176 100644
--- a/inc/SP/Controller/Controller.class.php
+++ b/inc/SP/Controller/ControllerBase.class.php
@@ -28,17 +28,18 @@ namespace SP\Controller;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
use SP\Core\Acl;
+use SP\Core\Exceptions\FileNotFoundException;
use SP\Core\Init;
use SP\Core\Session;
use SP\Core\Exceptions\SPException;
+use SP\Core\DiFactory;
use SP\Core\Template;
-use SP\Core\Themes;
-use Theme\Icons;
+use SP\Core\UI\ThemeIconsBase;
/**
* Clase base para los controladores
*/
-abstract class Controller
+abstract class ControllerBase
{
/**
* Constantes de errores
@@ -64,9 +65,15 @@ abstract class Controller
/**
* Instancia de los iconos del tema visual
*
- * @var Icons
+ * @var ThemeIconsBase
*/
protected $icons;
+ /**
+ * Nombre del controlador
+ *
+ * @var string
+ */
+ protected $controllerName;
/**
* Constructor
@@ -77,14 +84,15 @@ abstract class Controller
{
global $timeStart;
- if (is_null($template)) {
- $this->view = $this->getTemplate();
- } else {
- $this->view = $template;
- }
+ $class = get_called_class();
+ $this->controllerName = substr($class, strrpos($class, '\\') + 1, -strlen('Controller'));
+
+ $this->view = null === $template ? $this->getTemplate() : $template;
+ $this->view->setBase(strtolower($this->controllerName));
+
+ $this->icons = DiFactory::getTheme()->getIcons();
$this->view->assign('timeStart', $timeStart);
- $this->icons = Themes::getIcons();
$this->view->assign('icons', $this->icons);
}
@@ -114,11 +122,13 @@ abstract class Controller
*/
public function setAction($action)
{
- $this->action = $action;
+ $this->action = (int)$action;
}
/**
* Renderizar los datos de la plantilla y mostrarlos
+ *
+ * @throws FileNotFoundException
*/
public function view()
{
@@ -127,6 +137,8 @@ abstract class Controller
/**
* Renderizar los datos de la plantilla y devolverlos
+ *
+ * @throws FileNotFoundException
*/
public function render()
{
@@ -140,9 +152,9 @@ abstract class Controller
{
global $memInit;
- $this->view->addTemplate('debug');
+ $this->view->addTemplate('debug', 'common');
- $this->view->assign('time', (Init::microtime_float() - $this->view->timeStart));
+ $this->view->assign('time', Init::microtime_float() - $this->view->timeStart);
$this->view->assign('memInit', $memInit / 1000);
$this->view->assign('memEnd', memory_get_usage() / 1000);
}
@@ -167,15 +179,11 @@ abstract class Controller
{
$checkAction = $this->action;
- if (!is_null($action)) {
+ if (null !== $action) {
$checkAction = $action;
}
- if (!Session::getUserIsAdminApp() && !Acl::checkUserAccess($checkAction)) {
- return false;
- }
-
- return true;
+ return Session::getUserIsAdminApp() || Acl::checkUserAccess($checkAction);
}
/**
diff --git a/inc/SP/Controller/Eventlog.class.php b/inc/SP/Controller/EventlogController.class.php
similarity index 90%
rename from inc/SP/Controller/Eventlog.class.php
rename to inc/SP/Controller/EventlogController.class.php
index 5f2e9023..6cfccb3a 100644
--- a/inc/SP/Controller/Eventlog.class.php
+++ b/inc/SP/Controller/EventlogController.class.php
@@ -42,7 +42,7 @@ use SP\Util\Util;
*
* @package Controller
*/
-class Eventlog extends Controller implements ActionsInterface
+class EventlogController extends ControllerBase implements ActionsInterface
{
/**
* Número de máximo de registros por página
@@ -84,7 +84,7 @@ class Eventlog extends Controller implements ActionsInterface
$limitLast = (Log::$numRows % self::MAX_ROWS == 0) ? Log::$numRows - self::MAX_ROWS : floor(Log::$numRows / self::MAX_ROWS) * self::MAX_ROWS;
- $this->view->assign('pagerOnnClick', array(
+ $this->view->assign('pagerOnClick', array(
'first' => 'sysPassUtil.Common.navLog(0,' . $this->view->limitStart . ')',
'last' => 'sysPassUtil.Common.navLog(' . $limitLast . ',' . $this->view->limitStart . ')',
'prev' => 'sysPassUtil.Common.navLog(' . ($this->view->limitStart - self::MAX_ROWS) . ',' . $this->view->limitStart . ')',
@@ -102,9 +102,9 @@ class Eventlog extends Controller implements ActionsInterface
&& SessionUtil::checkSessionKey($this->view->sk)
) {
if (Log::clearEvents()) {
- Response::printJSON(_('Registro de eventos vaciado'), 0, "sysPassUtil.Common.doAction(" . ActionsInterface::ACTION_EVL . "); sysPassUtil.Common.scrollUp();");
+ Response::printJson(_('Registro de eventos vaciado'), 0, 'sysPassUtil.Common.doAction(' . ActionsInterface::ACTION_EVL . '); sysPassUtil.Common.scrollUp();');
} else {
- Response::printJSON(_('Error al vaciar el registro de eventos'));
+ Response::printJson(_('Error al vaciar el registro de eventos'));
}
}
}
diff --git a/inc/SP/Controller/GridItemsSearch.class.php b/inc/SP/Controller/GridItemsSearchController.class.php
similarity index 89%
rename from inc/SP/Controller/GridItemsSearch.class.php
rename to inc/SP/Controller/GridItemsSearchController.class.php
index eb95abbf..7ac6e920 100644
--- a/inc/SP/Controller/GridItemsSearch.class.php
+++ b/inc/SP/Controller/GridItemsSearchController.class.php
@@ -10,9 +10,9 @@ namespace SP\Controller;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
+use SP\Core\SessionUtil;
use SP\Core\Template;
use SP\DataModel\ItemSearchData;
-use SP\Html\DataGrid\DataGridPagerBase;
use SP\Html\DataGrid\DataGridPagerInterface;
use SP\Util\Checks;
@@ -21,7 +21,7 @@ use SP\Util\Checks;
*
* @package SP\Controller
*/
-abstract class GridItemsSearch extends Controller
+abstract class GridItemsSearchController extends ControllerBase
{
/**
* @var Grids
@@ -38,6 +38,7 @@ abstract class GridItemsSearch extends Controller
parent::__construct($template);
$this->view->assign('isDemo', Checks::demoIsEnabled());
+ $this->view->assign('sk', SessionUtil::getSessionKey(true));
$this->_grids = new Grids();
$this->_grids->setQueryTimeStart(microtime());
diff --git a/inc/SP/Controller/GridTabController.class.php b/inc/SP/Controller/GridTabControllerBase.class.php
similarity index 94%
rename from inc/SP/Controller/GridTabController.class.php
rename to inc/SP/Controller/GridTabControllerBase.class.php
index cf302119..164a143e 100644
--- a/inc/SP/Controller/GridTabController.class.php
+++ b/inc/SP/Controller/GridTabControllerBase.class.php
@@ -36,7 +36,7 @@ use SP\Util\Checks;
*
* @package SP\Controller
*/
-abstract class GridTabController extends Controller
+abstract class GridTabControllerBase extends ControllerBase
{
/**
* Máximo numero de acciones antes de agrupar
@@ -68,7 +68,7 @@ abstract class GridTabController extends Controller
$this->Grids = new Grids();
$this->Grids->setQueryTimeStart($this->view->queryTimeStart);
- $this->view->addTemplate('datatabs-grid');
+ $this->view->addTemplate('datatabs-grid', 'grid');
$this->view->assign('tabs', array());
$this->view->assign('activeTab', 0);
diff --git a/inc/SP/Controller/Grids.class.php b/inc/SP/Controller/Grids.class.php
index 5139656b..c517a1b8 100644
--- a/inc/SP/Controller/Grids.class.php
+++ b/inc/SP/Controller/Grids.class.php
@@ -30,8 +30,8 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
use SP\Config\Config;
use SP\Core\ActionsInterface;
use SP\Core\SessionUtil;
-use SP\Core\ThemeIconsBase;
-use SP\Core\Themes;
+use SP\Core\DiFactory;
+use SP\Core\UI\ThemeIconsBase;
use SP\Html\DataGrid\DataGridAction;
use SP\Html\DataGrid\DataGridActionSearch;
use SP\Html\DataGrid\DataGridActionType;
@@ -70,7 +70,7 @@ class Grids implements ActionsInterface
public function __construct()
{
$this->sk = SessionUtil::getSessionKey(true);
- $this->icons = Themes::getIcons();
+ $this->icons = DiFactory::getTheme()->getIcons();
}
/**
@@ -83,8 +83,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchCategory');
$GridActionSearch->setTitle(_('Buscar Categoría'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_MGM_CATEGORIES_NEW);
@@ -93,10 +92,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nueva Categoría'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_MGM_CATEGORIES_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_MGM_CATEGORIES_EDIT);
@@ -104,10 +100,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Categoría'));
$GridActionEdit->setTitle(_('Editar Categoría'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_MGM_CATEGORIES_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_CATEGORIES_DELETE);
@@ -115,10 +108,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Categoría'));
$GridActionDel->setTitle(_('Eliminar Categoría'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_CATEGORIES_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Nombre'));
@@ -131,8 +121,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblCategories');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionEdit);
@@ -155,8 +145,8 @@ class Grids implements ActionsInterface
public function getPager(DataGridActionSearch $sourceAction)
{
$GridPager = new DataGridPager();
- $GridPager->setOnClickFunction('sysPassUtil.Common.appMgmtNav');
- $GridPager->setOnClickArgs($sourceAction->getName());
+ $GridPager->setSourceAction($sourceAction);
+ $GridPager->setOnClickFunction('appMgmt/nav');
$GridPager->setLimitStart(0);
$GridPager->setLimitCount(Config::getConfig()->getAccountCount());
$GridPager->setIconPrev($this->icons->getIconNavPrev());
@@ -177,8 +167,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchCustomer');
$GridActionSearch->setTitle(_('Buscar Cliente'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_MGM_CUSTOMERS_NEW);
@@ -187,10 +176,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nuevo Cliente'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_MGM_CUSTOMERS_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_MGM_CUSTOMERS_EDIT);
@@ -198,10 +184,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Cliente'));
$GridActionEdit->setTitle(_('Editar Cliente'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_MGM_CUSTOMERS_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_CUSTOMERS_DELETE);
@@ -209,10 +192,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Cliente'));
$GridActionDel->setTitle(_('Eliminar Cliente'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_CUSTOMERS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Nombre'));
@@ -225,8 +205,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblCustomers');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionEdit);
@@ -250,8 +230,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchCustomField');
$GridActionSearch->setTitle(_('Buscar Campo'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_MGM_CUSTOMFIELDS_NEW);
@@ -260,10 +239,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nuevo Campo'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_MGM_CUSTOMFIELDS_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_MGM_CUSTOMFIELDS_EDIT);
@@ -271,10 +247,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Campo'));
$GridActionEdit->setTitle(_('Editar Campo'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_MGM_CUSTOMFIELDS_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_CUSTOMFIELDS_DELETE);
@@ -282,10 +255,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Campo'));
$GridActionDel->setTitle(_('Eliminar Campo'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_CUSTOMFIELDS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Módulo'));
@@ -300,8 +270,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblCustomFields');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionEdit);
@@ -325,28 +295,21 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchFile');
$GridActionSearch->setTitle(_('Buscar Archivo'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionView = new DataGridAction();
$GridActionView->setId(self::ACTION_MGM_FILES_VIEW);
$GridActionView->setType(DataGridActionType::VIEW_ITEM);
$GridActionView->setName(_('Ver Archivo'));
$GridActionView->setIcon($this->icons->getIconView());
- $GridActionView->setOnClickFunction('sysPassUtil.Common.viewFile');
- $GridActionView->setOnClickArgs('this');
- $GridActionView->setOnClickArgs(self::ACTION_MGM_FILES_VIEW);
- $GridActionView->setOnClickArgs($this->sk);
+ $GridActionView->setOnClickFunction('file/view');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_FILES_DELETE);
$GridActionDel->setType(DataGridActionType::DELETE_ITEM);
$GridActionDel->setName(_('Eliminar Archivo'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_FILES_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Cuenta'));
@@ -365,8 +328,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblFiles');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionView);
$Grid->setDataActions($GridActionDel);
$Grid->setDataActions($GridActionSearch);
@@ -389,8 +352,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchAccount');
$GridActionSearch->setTitle(_('Buscar Cuenta'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_ACCOUNTS_DELETE);
@@ -398,10 +360,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Cuenta'));
$GridActionDel->setTitle(_('Eliminar Cuenta'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_ACCOUNTS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Nombre'));
@@ -414,8 +373,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblAccounts');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionDel);
$Grid->setHeader($GridHeaders);
@@ -437,8 +396,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchUser');
$GridActionSearch->setTitle(_('Buscar Usuario'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_USR_USERS_NEW);
@@ -447,10 +405,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nuevo Usuario'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_USR_USERS_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionView = new DataGridAction();
$GridActionView->setId(self::ACTION_USR_USERS_VIEW);
@@ -458,10 +413,7 @@ class Grids implements ActionsInterface
$GridActionView->setName(_('Ver Detalles de Usuario'));
$GridActionView->setTitle(_('Ver Detalles de Usuario'));
$GridActionView->setIcon($this->icons->getIconView());
- $GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionView->setOnClickArgs('this');
- $GridActionView->setOnClickArgs(self::ACTION_USR_USERS_VIEW);
- $GridActionView->setOnClickArgs($this->sk);
+ $GridActionView->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_USR_USERS_EDIT);
@@ -469,10 +421,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Usuario'));
$GridActionEdit->setTitle(_('Editar Usuario'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_USR_USERS_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_USR_USERS_DELETE);
@@ -480,10 +429,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Usuario'));
$GridActionDel->setTitle(_('Eliminar Usuario'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_USR_USERS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridActionEditPass = new DataGridAction();
$GridActionEditPass->setId(self::ACTION_USR_USERS_EDITPASS);
@@ -491,10 +437,7 @@ class Grids implements ActionsInterface
$GridActionEditPass->setName(_('Cambiar Clave de Usuario'));
$GridActionEditPass->setTitle(_('Cambiar Clave de Usuario'));
$GridActionEditPass->setIcon($this->icons->getIconEditPass());
- $GridActionEditPass->setOnClickFunction('sysPassUtil.Common.usrUpdPass');
- $GridActionEditPass->setOnClickArgs('this');
- $GridActionEditPass->setOnClickArgs(self::ACTION_USR_USERS_EDITPASS);
- $GridActionEditPass->setOnClickArgs($this->sk);
+ $GridActionEditPass->setOnClickFunction('appMgmt/userpass');
$GridActionEditPass->setFilterRowSource('user_isLdap');
$GridHeaders = new DataGridHeader();
@@ -517,8 +460,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblUsers');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionView);
@@ -544,8 +487,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchGroup');
$GridActionSearch->setTitle(_('Buscar Grupo'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_USR_GROUPS_NEW);
@@ -554,10 +496,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nuevo Grupo'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_USR_GROUPS_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_USR_GROUPS_EDIT);
@@ -565,10 +504,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Grupo'));
$GridActionEdit->setTitle(_('Editar Grupo'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_USR_GROUPS_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_USR_GROUPS_DELETE);
@@ -576,10 +512,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Grupo'));
$GridActionDel->setTitle(_('Eliminar Grupo'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_USR_GROUPS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Nombre'));
@@ -592,8 +525,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblGroups');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionEdit);
@@ -617,8 +550,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchProfile');
$GridActionSearch->setTitle(_('Buscar Perfil'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_USR_PROFILES_NEW);
@@ -627,10 +559,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nuevo Perfil'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_USR_PROFILES_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionView = new DataGridAction();
$GridActionView->setId(self::ACTION_USR_PROFILES_VIEW);
@@ -638,10 +567,7 @@ class Grids implements ActionsInterface
$GridActionView->setName(_('Ver Detalles de Perfil'));
$GridActionView->setTitle(_('Ver Detalles de Perfil'));
$GridActionView->setIcon($this->icons->getIconView());
- $GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionView->setOnClickArgs('this');
- $GridActionView->setOnClickArgs(self::ACTION_USR_PROFILES_VIEW);
- $GridActionView->setOnClickArgs($this->sk);
+ $GridActionView->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_USR_PROFILES_EDIT);
@@ -649,10 +575,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Perfil'));
$GridActionEdit->setTitle(_('Editar Perfil'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_USR_PROFILES_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_USR_PROFILES_DELETE);
@@ -660,7 +583,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Perfil'));
$GridActionDel->setTitle(_('Eliminar Perfil'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridActionDel->setOnClickArgs('this');
$GridActionDel->setOnClickArgs(self::ACTION_USR_PROFILES_DELETE);
$GridActionDel->setOnClickArgs($this->sk);
@@ -674,8 +597,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblProfiles');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionView);
@@ -700,8 +623,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchToken');
$GridActionSearch->setTitle(_('Buscar Token'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_MGM_APITOKENS_NEW);
@@ -710,10 +632,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nueva Autorización'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_MGM_APITOKENS_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionView = new DataGridAction();
$GridActionView->setId(self::ACTION_MGM_APITOKENS_VIEW);
@@ -721,10 +640,7 @@ class Grids implements ActionsInterface
$GridActionView->setName(_('Ver token de Autorización'));
$GridActionView->setTitle(_('Ver token de Autorización'));
$GridActionView->setIcon($this->icons->getIconView());
- $GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionView->setOnClickArgs('this');
- $GridActionView->setOnClickArgs(self::ACTION_MGM_APITOKENS_VIEW);
- $GridActionView->setOnClickArgs($this->sk);
+ $GridActionView->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_MGM_APITOKENS_EDIT);
@@ -732,10 +648,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Autorización'));
$GridActionEdit->setTitle(_('Editar Autorización'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_MGM_APITOKENS_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_APITOKENS_DELETE);
@@ -743,10 +656,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Autorización'));
$GridActionDel->setTitle(_('Eliminar Autorización'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_APITOKENS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Usuario'));
@@ -759,8 +669,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblTokens');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionView);
@@ -785,8 +695,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchLink');
$GridActionSearch->setTitle(_('Buscar Enlace'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionView = new DataGridAction();
$GridActionView->setId(self::ACTION_MGM_PUBLICLINKS_VIEW);
@@ -794,20 +703,14 @@ class Grids implements ActionsInterface
$GridActionView->setName(_('Ver Enlace'));
$GridActionView->setTitle(_('Ver Enlace'));
$GridActionView->setIcon($this->icons->getIconView());
- $GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionView->setOnClickArgs('this');
- $GridActionView->setOnClickArgs(self::ACTION_MGM_PUBLICLINKS_VIEW);
- $GridActionView->setOnClickArgs($this->sk);
+ $GridActionView->setOnClickFunction('appMgmt/show');
$GridActionRefresh = new DataGridAction();
$GridActionRefresh->setId(self::ACTION_MGM_PUBLICLINKS_REFRESH);
$GridActionRefresh->setName(_('Renovar Enlace'));
$GridActionRefresh->setTitle(_('Renovar Enlace'));
$GridActionRefresh->setIcon($this->icons->getIconRefresh());
- $GridActionRefresh->setOnClickFunction('sysPassUtil.Common.linksMgmtRefresh');
- $GridActionRefresh->setOnClickArgs('this');
- $GridActionRefresh->setOnClickArgs(self::ACTION_MGM_PUBLICLINKS_REFRESH);
- $GridActionRefresh->setOnClickArgs($this->sk);
+ $GridActionRefresh->setOnClickFunction('appMgmt/linksMgmtRefresh');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_PUBLICLINKS_DELETE);
@@ -815,10 +718,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Enlace'));
$GridActionDel->setTitle(_('Eliminar Enlace'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_PUBLICLINKS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Cuenta'));
@@ -839,8 +739,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblLinks');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionView);
$Grid->setDataActions($GridActionRefresh);
@@ -864,8 +764,7 @@ class Grids implements ActionsInterface
$GridActionSearch->setType(DataGridActionType::SEARCH_ITEM);
$GridActionSearch->setName('frmSearchTag');
$GridActionSearch->setTitle(_('Buscar Etiqueta'));
- $GridActionSearch->setOnSubmitFunction('sysPassUtil.Common.appMgmtSearch');
- $GridActionSearch->setOnSubmitArgs('this');
+ $GridActionSearch->setOnSubmitFunction('appMgmt/search');
$GridActionNew = new DataGridAction();
$GridActionNew->setId(self::ACTION_MGM_TAGS_NEW);
@@ -874,10 +773,7 @@ class Grids implements ActionsInterface
$GridActionNew->setTitle(_('Nueva Etiqueta'));
$GridActionNew->setIcon($this->icons->getIconAdd());
$GridActionNew->setSkip(true);
- $GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionNew->setOnClickArgs('this');
- $GridActionNew->setOnClickArgs(self::ACTION_MGM_TAGS_NEW);
- $GridActionNew->setOnClickArgs($this->sk);
+ $GridActionNew->setOnClickFunction('appMgmt/show');
$GridActionEdit = new DataGridAction();
$GridActionEdit->setId(self::ACTION_MGM_TAGS_EDIT);
@@ -885,10 +781,7 @@ class Grids implements ActionsInterface
$GridActionEdit->setName(_('Editar Etiqueta'));
$GridActionEdit->setTitle(_('Editar Etiqueta'));
$GridActionEdit->setIcon($this->icons->getIconEdit());
- $GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
- $GridActionEdit->setOnClickArgs('this');
- $GridActionEdit->setOnClickArgs(self::ACTION_MGM_TAGS_EDIT);
- $GridActionEdit->setOnClickArgs($this->sk);
+ $GridActionEdit->setOnClickFunction('appMgmt/show');
$GridActionDel = new DataGridAction();
$GridActionDel->setId(self::ACTION_MGM_TAGS_DELETE);
@@ -896,10 +789,7 @@ class Grids implements ActionsInterface
$GridActionDel->setName(_('Eliminar Etiqueta'));
$GridActionDel->setTitle(_('Eliminar Etiqueta'));
$GridActionDel->setIcon($this->icons->getIconDelete());
- $GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
- $GridActionDel->setOnClickArgs('this');
- $GridActionDel->setOnClickArgs(self::ACTION_MGM_TAGS_DELETE);
- $GridActionDel->setOnClickArgs($this->sk);
+ $GridActionDel->setOnClickFunction('appMgmt/delete');
$GridHeaders = new DataGridHeader();
$GridHeaders->addHeader(_('Nombre'));
@@ -910,8 +800,8 @@ class Grids implements ActionsInterface
$Grid = new DataGridTab();
$Grid->setId('tblTags');
- $Grid->setDataRowTemplate('datagrid-rows');
- $Grid->setDataPagerTemplate('datagrid-nav-full');
+ $Grid->setDataRowTemplate('datagrid-rows', 'grid');
+ $Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
$Grid->setDataActions($GridActionSearch);
$Grid->setDataActions($GridActionNew);
$Grid->setDataActions($GridActionEdit);
diff --git a/inc/SP/Controller/ItemsController.class.php b/inc/SP/Controller/ItemsController.class.php
new file mode 100644
index 00000000..3e5c20da
--- /dev/null
+++ b/inc/SP/Controller/ItemsController.class.php
@@ -0,0 +1,102 @@
+.
+ */
+
+namespace SP\Controller;
+
+use SP\Core\ItemsTypeInterface;
+use SP\DataModel\DataModelInterface;
+use SP\Mgmt\Categories\Category;
+use SP\Mgmt\Customers\Customer;
+
+
+/**
+ * Class ItemsController
+ *
+ * @package SP\Controller
+ */
+class ItemsController
+{
+ /**
+ * Devuelve los elementos solicitados
+ *
+ * @param $itemType int El tipo de elemento a devolver
+ * @return array
+ */
+ public function getGetItems($itemType)
+ {
+
+ switch ($itemType) {
+ case ItemsTypeInterface::ITEM_CATEGORIES:
+ return $this->getCategories();
+ break;
+ case ItemsTypeInterface::ITEM_CUSTOMERS:
+ return $this->getCustomers();
+ break;
+ default:
+ return [];
+ }
+ }
+
+ /**
+ * Devuelve las categorías disponibles
+ *
+ * @return array
+ */
+ protected function getCategories()
+ {
+ return $this->prepareItems(Category::getItem()->getAll());
+ }
+
+ /**
+ * Preparar los elementos para devolverlos
+ *
+ * @param array $items
+ * @return array
+ */
+ protected function prepareItems(array $items)
+ {
+ $outItems = [];
+
+ /** @var DataModelInterface $item */
+ foreach ($items as $item) {
+ $obj = new \stdClass();
+ $obj->id = $item->getId();
+ $obj->name = $item->getName();
+
+ $outItems[] = $obj;
+ }
+
+ return $outItems;
+ }
+
+ /**
+ * Devuelve los clientes disponibles
+ *
+ * @return array
+ */
+ protected function getCustomers()
+ {
+ return $this->prepareItems(Customer::getItem()->getAll());
+ }
+}
\ No newline at end of file
diff --git a/inc/SP/Controller/Main.class.php b/inc/SP/Controller/MainController.class.php
similarity index 81%
rename from inc/SP/Controller/Main.class.php
rename to inc/SP/Controller/MainController.class.php
index 837fbf36..662605ea 100644
--- a/inc/SP/Controller/Main.class.php
+++ b/inc/SP/Controller/MainController.class.php
@@ -30,6 +30,7 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
use SP\Core\ActionsInterface;
use SP\Core\Init;
use SP\Core\Installer;
+use SP\Core\DiFactory;
use SP\Core\Template;
use SP\DataModel\InstallData;
use SP\Html\Html;
@@ -38,7 +39,6 @@ use SP\Http\Request;
use SP\Core\Session;
use SP\Core\SessionUtil;
use SP\Core\Exceptions\SPException;
-use SP\Core\Themes;
use SP\Util\Checks;
use SP\Util\Util;
@@ -48,7 +48,7 @@ use SP\Util\Util;
*
* @package Controller
*/
-class Main extends Controller implements ActionsInterface
+class MainController extends ControllerBase implements ActionsInterface
{
/**
* Constructor
@@ -73,7 +73,7 @@ class Main extends Controller implements ActionsInterface
$this->view->assign('isDemoMode', Checks::demoIsEnabled());
$this->view->assign('loggedIn', Init::isLoggedIn());
$this->view->assign('page', $page);
- $this->view->assign('icons', Themes::getIcons());
+ $this->view->assign('icons', DiFactory::getTheme()->getIcons());
$this->view->assign('logoIcon', Init::$WEBURI . '/imgs/logo.png');
$this->view->assign('logoNoText', Init::$WEBURI . '/imgs/logo.svg');
$this->view->assign('logo', Init::$WEBURI . '/imgs/logo_full.svg');
@@ -92,34 +92,35 @@ class Main extends Controller implements ActionsInterface
*/
public function getResourcesLinks()
{
- $cssVersionHash = 'v=' . md5(implode(Util::getVersion()) . Checks::resultsCardsIsEnabled());
- $this->view->assign('cssLink', Init::$WEBROOT . '/css/css.php?' . $cssVersionHash);
+ $jsVersionHash = md5(implode(Util::getVersion()));
+ $this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?v=' . $jsVersionHash);
+ $this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?g=1&v=' . $jsVersionHash);
- $jsVersionHash = 'v=' . md5(implode(Util::getVersion()));
- $this->view->assign('jsLink', Init::$WEBROOT . '/js/js.php?' . $jsVersionHash);
-
- $themeInfo = Themes::getThemeInfo();
+ $themeInfo = DiFactory::getTheme()->getThemeInfo();
if (isset($themeInfo['js'])) {
- $themeJsBase = 'b=' . urlencode(Themes::$themePath . DIRECTORY_SEPARATOR . 'js');
- $themeJsFiles = 'f=' . urlencode(implode(',', $themeInfo['js']));
+ $themeJsBase = urlencode(DiFactory::getTheme()->getThemePath() . DIRECTORY_SEPARATOR . 'js');
+ $themeJsFiles = urlencode(implode(',', $themeInfo['js']));
- $this->view->assign('jsLinkTheme', Init::$WEBROOT . '/js/js.php?' . $themeJsFiles . '&' . $themeJsBase . '&' . $jsVersionHash);
+ $this->view->append('jsLinks', Init::$WEBROOT . '/js/js.php?f=' . $themeJsFiles . '&b=' . $themeJsBase . '&v=' . $jsVersionHash);
}
+ $cssVersionHash = md5(implode(Util::getVersion()) . Checks::resultsCardsIsEnabled());
+ $this->view->append('cssLinks', Init::$WEBROOT . '/css/css.php?v=' . $cssVersionHash);
+
if (isset($themeInfo['css'])) {
if (!Checks::resultsCardsIsEnabled()) {
- array_push($themeInfo['css'], 'search-grid.min.css');
+ $themeInfo['css'][] = 'search-grid.min.css';
}
if (Checks::dokuWikiIsEnabled()) {
- array_push($themeInfo['css'], 'styles-wiki.min.css');
+ $themeInfo['css'][] = 'styles-wiki.min.css';
}
- $themeCssBase = 'b=' . urlencode(Themes::$themePath . DIRECTORY_SEPARATOR . 'css');
- $themeCssFiles = 'f=' . urlencode(implode(',', $themeInfo['css']));
+ $themeCssBase = urlencode(DiFactory::getTheme()->getThemePath() . DIRECTORY_SEPARATOR . 'css');
+ $themeCssFiles = urlencode(implode(',', $themeInfo['css']));
- $this->view->assign('cssLinkTheme', Init::$WEBROOT . '/css/css.php?' . $themeCssFiles . '&' . $themeCssBase . '&' . $jsVersionHash);
+ $this->view->append('cssLinks', Init::$WEBROOT . '/css/css.php?f=' . $themeCssFiles . '&b=' . $themeCssBase . '&v=' . $jsVersionHash);
}
}
@@ -129,32 +130,18 @@ class Main extends Controller implements ActionsInterface
private function setResponseHeaders()
{
// UTF8 Headers
- header("Content-Type: text/html; charset=UTF-8");
+ header('Content-Type: text/html; charset=UTF-8');
// Cache Control
- header("Cache-Control: public, no-cache, max-age=0, must-revalidate");
- header("Pragma: public; max-age=0");
+ header('Cache-Control: public, no-cache, max-age=0, must-revalidate');
+ header('Pragma: public; max-age=0');
}
/**
* Obtener los datos para el interface principal de sysPass
- *
- * @param string $onLoad Las acciones a realizar en la carga de la página
*/
- public function getMain($onLoad = null)
+ public function getMain()
{
- if (is_null($onLoad)) {
- $onLoad = array('sysPassUtil.Common.doAction(' . self::ACTION_ACC_SEARCH . ')');
-
- if (Session::getUserIsAdminApp() || Checks::demoIsEnabled()) {
- $onLoad[] = 'sysPassUtil.Common.checkUpds()';
- }
-
- $this->view->assign('onLoad', implode(';', $onLoad));
- } else {
- $this->view->assign('onLoad', $onLoad);
- }
-
$this->getSessionBar();
$this->getMenu();
@@ -169,10 +156,10 @@ class Main extends Controller implements ActionsInterface
{
$this->view->addTemplate('sessionbar');
- $this->view->assign('adminApp', (Session::getUserIsAdminApp()) ? '(A+)' : '');
+ $this->view->assign('adminApp', Session::getUserIsAdminApp() ? '(A+)' : '');
$this->view->assign('userId', Session::getUserId());
$this->view->assign('userLogin', strtoupper(Session::getUserLogin()));
- $this->view->assign('userName', (Session::getUserName()) ? Session::getUserName() : strtoupper($this->view->userLogin));
+ $this->view->assign('userName', Session::getUserName() ?: strtoupper($this->view->userLogin));
$this->view->assign('userGroup', Session::getUserGroupName());
$this->view->assign('showPassIcon', !Session::getUserIsLdap());
}
@@ -184,44 +171,50 @@ class Main extends Controller implements ActionsInterface
{
$this->view->addTemplate('menu');
- $this->view->assign('actions', array(
- array(
- 'name' => self::ACTION_ACC_SEARCH,
+ $this->view->assign('actions', [
+ [
+ 'id' => self::ACTION_ACC_SEARCH,
'title' => _('Buscar'),
'img' => 'search.png',
'icon' => 'search',
- 'checkaccess' => 0),
- array(
- 'name' => self::ACTION_ACC_NEW,
+ 'checkaccess' => 0,
+ 'historyReset' => 1],
+ [
+ 'id' => self::ACTION_ACC_NEW,
'title' => _('Nueva Cuenta'),
'img' => 'add.png',
'icon' => 'add',
- 'checkaccess' => 1),
- array(
- 'name' => self::ACTION_USR,
+ 'checkaccess' => 1,
+ 'historyReset' => 0],
+ [
+ 'id' => self::ACTION_USR,
'title' => _('Usuarios y Accesos'),
'img' => 'users.png',
'icon' => 'account_box',
- 'checkaccess' => 1),
- array(
- 'name' => self::ACTION_MGM,
+ 'checkaccess' => 1,
+ 'historyReset' => 0],
+ [
+ 'id' => self::ACTION_MGM,
'title' => _('Elementos y Personalización'),
'img' => 'appmgmt.png',
'icon' => 'group_work',
- 'checkaccess' => 1),
- array(
- 'name' => self::ACTION_CFG,
+ 'checkaccess' => 1,
+ 'historyReset' => 0],
+ [
+ 'id' => self::ACTION_CFG,
'title' => _('Configuración'),
'img' => 'config.png',
'icon' => 'settings_applications',
- 'checkaccess' => 1),
- array(
- 'name' => self::ACTION_EVL,
+ 'checkaccess' => 1,
+ 'historyReset' => 1],
+ [
+ 'id' => self::ACTION_EVL,
'title' => _('Registro de Eventos'),
'img' => 'log.png',
'icon' => 'view_headline',
- 'checkaccess' => 1)
- ));
+ 'checkaccess' => 1,
+ 'historyReset' => 1]
+ ]);
}
/**
@@ -456,7 +449,7 @@ class Main extends Controller implements ActionsInterface
} else {
$PublicLink->addLinkView();
- $controller = new Account($this->view, null, $PublicLink->getItemData()->getItemId());
+ $controller = new AccountController($this->view, null, $PublicLink->getItemData()->getItemId());
$controller->getAccountFromLink($PublicLink);
}
diff --git a/inc/SP/Controller/UsersPrefs.class.php b/inc/SP/Controller/UserPreferencesController.class.php
similarity index 79%
rename from inc/SP/Controller/UsersPrefs.class.php
rename to inc/SP/Controller/UserPreferencesController.class.php
index ce84bf30..db130056 100644
--- a/inc/SP/Controller/UsersPrefs.class.php
+++ b/inc/SP/Controller/UserPreferencesController.class.php
@@ -33,8 +33,9 @@ use SP\Core\ActionsInterface;
use SP\Core\Language;
use SP\Core\Session;
use SP\Core\SessionUtil;
+use SP\Core\DiFactory;
use SP\Core\Template;
-use SP\Core\Themes;
+use SP\Core\Theme;
use SP\DataModel\UserPreferencesData;
use SP\Mgmt\Users\UserPreferences;
@@ -44,7 +45,7 @@ use SP\Mgmt\Users\UserPreferences;
*
* @package SP\Controller
*/
-class UsersPrefs extends Controller implements ActionsInterface
+class UserPreferencesController extends ControllerBase implements ActionsInterface
{
/**
* @var int
@@ -124,13 +125,13 @@ class UsersPrefs extends Controller implements ActionsInterface
$this->view->assign('userId', $this->userId);
$this->view->assign('langsAvailable', Language::getAvailableLanguages());
$this->view->assign('currentLang', $this->userPrefs->getLang());
- $this->view->assign('themesAvailable', Themes::getThemesAvailable());
- $this->view->assign('currentTheme', ($this->userPrefs->getTheme()) ? $this->userPrefs->getTheme() : Config::getConfig()->getSiteTheme());
- $this->view->assign('chkAccountLink', ($this->userPrefs->isAccountLink()) ? 'checked="checked"' : '');
- $this->view->assign('resultsPerPage', ($this->userPrefs->getResultsPerPage()) ? $this->userPrefs->getResultsPerPage() : Config::getConfig()->getAccountCount());
- $this->view->assign('chkSortViews', ($this->userPrefs->isSortViews()) ? 'checked="checked"' : '');
- $this->view->assign('chkTopNavbar', ($this->userPrefs->isTopNavbar()) ? 'checked="checked"' : '');
- $this->view->assign('chkOptionalActions', ($this->userPrefs->isOptionalActions()) ? 'checked="checked"' : '');
+ $this->view->assign('themesAvailable', DiFactory::getTheme()->getThemesAvailable());
+ $this->view->assign('currentTheme', $this->userPrefs->getTheme() ?: Config::getConfig()->getSiteTheme());
+ $this->view->assign('chkAccountLink', $this->userPrefs->isAccountLink() ? 'checked="checked"' : '');
+ $this->view->assign('resultsPerPage', $this->userPrefs->getResultsPerPage() ? $this->userPrefs->getResultsPerPage() : Config::getConfig()->getAccountCount());
+ $this->view->assign('chkSortViews', $this->userPrefs->isSortViews() ? 'checked="checked"' : '');
+ $this->view->assign('chkTopNavbar', $this->userPrefs->isTopNavbar() ? 'checked="checked"' : '');
+ $this->view->assign('chkOptionalActions', $this->userPrefs->isOptionalActions() ? 'checked="checked"' : '');
$this->view->append('tabs', array('title' => _('Preferencias')));
$this->view->assign('tabIndex', $this->getTabIndex(), 'preferences');
diff --git a/inc/SP/Controller/Wiki.class.php b/inc/SP/Controller/WikiController.class.php
similarity index 97%
rename from inc/SP/Controller/Wiki.class.php
rename to inc/SP/Controller/WikiController.class.php
index 80ca3121..6b41f52b 100644
--- a/inc/SP/Controller/Wiki.class.php
+++ b/inc/SP/Controller/WikiController.class.php
@@ -41,7 +41,7 @@ use SP\Util\Wiki\DokuWikiApi;
*
* @package SP\Controller
*/
-class Wiki extends Controller implements ActionsInterface
+class WikiController extends ControllerBase implements ActionsInterface
{
/**
* Constructor
diff --git a/inc/SP/Core/Acl.class.php b/inc/SP/Core/Acl.class.php
index 558d394d..3019acb3 100644
--- a/inc/SP/Core/Acl.class.php
+++ b/inc/SP/Core/Acl.class.php
@@ -62,61 +62,65 @@ class Acl implements ActionsInterface
$curUserProfile = Session::getUserProfile();
$curUserId = Session::getUserId();
+ if ($curUserIsAdminApp) {
+ return true;
+ }
+
switch ($action) {
case self::ACTION_ACC_VIEW:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccView() || $curUserProfile->isAccEdit());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccView() || $curUserProfile->isAccEdit());
case self::ACTION_ACC_VIEW_PASS:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccViewPass());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccViewPass());
case self::ACTION_ACC_VIEW_HISTORY:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccViewHistory());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccViewHistory());
case self::ACTION_ACC_EDIT:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccEdit());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccEdit());
case self::ACTION_ACC_EDIT_PASS:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccEditPass());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccEditPass());
case self::ACTION_ACC_NEW:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccAdd());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccAdd());
case self::ACTION_ACC_COPY:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || ($curUserProfile->isAccAdd() && $curUserProfile->isAccView()));
+ return ($curUserIsAdminAcc || ($curUserProfile->isAccAdd() && $curUserProfile->isAccView()));
case self::ACTION_ACC_DELETE:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccDelete());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccDelete());
case self::ACTION_ACC_FILES:
- return ($curUserIsAdminApp || $curUserIsAdminAcc || $curUserProfile->isAccFiles());
+ return ($curUserIsAdminAcc || $curUserProfile->isAccFiles());
case self::ACTION_MGM:
- return ($curUserIsAdminApp || $curUserProfile->isMgmCategories() || $curUserProfile->isMgmCustomers());
+ return ($curUserProfile->isMgmCategories() || $curUserProfile->isMgmCustomers());
case self::ACTION_CFG:
- return ($curUserIsAdminApp || $curUserProfile->isConfigGeneral() || $curUserProfile->isConfigEncryption() || $curUserProfile->isConfigBackup() || $curUserProfile->isConfigImport());
+ return ($curUserProfile->isConfigGeneral() || $curUserProfile->isConfigEncryption() || $curUserProfile->isConfigBackup() || $curUserProfile->isConfigImport());
case self::ACTION_CFG_GENERAL:
- return ($curUserIsAdminApp || $curUserProfile->isConfigGeneral());
+ return ($curUserProfile->isConfigGeneral());
case self::ACTION_CFG_IMPORT:
- return ($curUserIsAdminApp || $curUserProfile->isConfigImport());
+ return ($curUserProfile->isConfigImport());
case self::ACTION_MGM_CATEGORIES:
- return ($curUserIsAdminApp || $curUserProfile->isMgmCategories());
+ return ($curUserProfile->isMgmCategories());
case self::ACTION_MGM_CUSTOMERS:
- return ($curUserIsAdminApp || $curUserProfile->isMgmCustomers());
+ return ($curUserProfile->isMgmCustomers());
case self::ACTION_MGM_CUSTOMFIELDS:
- return ($curUserIsAdminApp || $curUserProfile->isMgmCustomFields());
+ return ($curUserProfile->isMgmCustomFields());
case self::ACTION_MGM_PUBLICLINKS:
- return ($curUserIsAdminApp || $curUserProfile->isMgmPublicLinks());
+ return ($curUserProfile->isMgmPublicLinks());
case self::ACTION_MGM_PUBLICLINKS_NEW:
- return ($curUserIsAdminApp || $curUserProfile->isMgmPublicLinks() || $curUserProfile->isAccPublicLinks());
+ return ($curUserProfile->isMgmPublicLinks() || $curUserProfile->isAccPublicLinks());
case self::ACTION_CFG_ENCRYPTION:
- return ($curUserIsAdminApp || $curUserProfile->isConfigEncryption());
+ return ($curUserProfile->isConfigEncryption());
case self::ACTION_CFG_BACKUP:
- return ($curUserIsAdminApp || $curUserProfile->isConfigBackup());
+ return ($curUserProfile->isConfigBackup());
case self::ACTION_USR:
- return ($curUserIsAdminApp || $curUserProfile->isMgmUsers() || $curUserProfile->isMgmGroups() || $curUserProfile->isMgmProfiles());
+ return ($curUserProfile->isMgmUsers() || $curUserProfile->isMgmGroups() || $curUserProfile->isMgmProfiles());
case self::ACTION_USR_USERS:
- return ($curUserIsAdminApp || $curUserProfile->isMgmUsers());
+ return ($curUserProfile->isMgmUsers());
case self::ACTION_USR_USERS_EDITPASS:
- return ($userId == $curUserId || $curUserIsAdminApp || $curUserProfile->isMgmUsers());
+ return ($userId == $curUserId || $curUserProfile->isMgmUsers());
case self::ACTION_USR_GROUPS:
- return ($curUserIsAdminApp || $curUserProfile->isMgmGroups());
+ return ($curUserProfile->isMgmGroups());
case self::ACTION_USR_PROFILES:
- return ($curUserIsAdminApp || $curUserProfile->isMgmProfiles());
+ return ($curUserProfile->isMgmProfiles());
case self::ACTION_MGM_APITOKENS:
- return ($curUserIsAdminApp || $curUserProfile->isMgmApiTokens());
+ return ($curUserProfile->isMgmApiTokens());
case self::ACTION_EVL:
- return ($curUserIsAdminApp || $curUserProfile->isEvl());
+ return ($curUserProfile->isEvl());
}
Log::writeNewLog(__FUNCTION__, sprintf('%s \'%s\'', _('Denegado acceso a'), self::getActionName($action)), Log::NOTICE);
@@ -197,15 +201,15 @@ class Acl implements ActionsInterface
case self::ACTION_ACC_VIEW_PASS:
case self::ACTION_ACC_VIEW_HISTORY:
case self::ACTION_ACC_COPY:
- return ($userId == $accountData->getAccountUserId()
- || $userGroupId == $accountData->getAccountUserGroupId()
+ return ($userId === $accountData->getAccountUserId()
+ || $userGroupId === $accountData->getAccountUserGroupId()
|| $userInUsers
|| $userInGroups);
case self::ACTION_ACC_EDIT:
case self::ACTION_ACC_DELETE:
case self::ACTION_ACC_EDIT_PASS:
- return ($userId == $accountData->getAccountUserId()
- || $userGroupId == $accountData->getAccountUserGroupId()
+ return ($userId === $accountData->getAccountUserId()
+ || $userGroupId === $accountData->getAccountUserGroupId()
|| ($userInUsers && $accountData->getAccountOtherUserEdit())
|| ($userInGroups && $accountData->getAccountOtherGroupEdit()));
default:
diff --git a/inc/SP/Core/SingleFactory.class.php b/inc/SP/Core/DiFactory.class.php
similarity index 79%
rename from inc/SP/Core/SingleFactory.class.php
rename to inc/SP/Core/DiFactory.class.php
index af7a44a3..d2027edc 100644
--- a/inc/SP/Core/SingleFactory.class.php
+++ b/inc/SP/Core/DiFactory.class.php
@@ -25,6 +25,8 @@
namespace SP\Core;
+use SP\Core\UI\Theme;
+use SP\Core\UI\ThemeInterface;
use SP\Mgmt\ItemBase;
use SP\Storage\MySQLHandler;
use SP\Storage\DBStorageInterface;
@@ -32,11 +34,11 @@ use SP\Storage\FileStorageInterface;
use SP\Storage\XmlHandler;
/**
- * Class Factory
+ * Class SingleFactory
*
* @package SP\Core
*/
-class SingleFactory
+class DiFactory
{
/**
* @var FileStorageInterface
@@ -50,13 +52,18 @@ class SingleFactory
* @var ItemBase[]
*/
private static $ItemFactory = [];
+ /**
+ * @var ThemeInterface
+ */
+ private static $ThemeFactory;
/**
* Devuelve el almacenamiento para la configuración
*
* @return FileStorageInterface
*/
- public static final function getConfigStorage(){
+ public static final function getConfigStorage()
+ {
if (!self::$ConfigFactory instanceof FileStorageInterface) {
self::$ConfigFactory = new XmlHandler(XML_CONFIG_FILE);
}
@@ -81,8 +88,8 @@ class SingleFactory
/**
* Devuelve la instancia de la clase del elemento solicitado
*
- * @param string $caller La clase del objeto
- * @param object $itemData Los datos del elemento
+ * @param string $caller La clase del objeto
+ * @param object $itemData Los datos del elemento
* @return object
* @throws Exceptions\InvalidClassException
*/
@@ -98,4 +105,18 @@ class SingleFactory
return self::$ItemFactory[$caller];
}
+
+ /**
+ * Devuelve el manejador para el tema visual
+ *
+ * @return ThemeInterface
+ */
+ public static final function getTheme()
+ {
+ if (!self::$ThemeFactory instanceof Theme) {
+ self::$ThemeFactory = new Theme();
+ }
+
+ return self::$ThemeFactory;
+ }
}
\ No newline at end of file
diff --git a/inc/SP/Core/Exceptions/FileNotFoundException.class.php b/inc/SP/Core/Exceptions/FileNotFoundException.class.php
new file mode 100644
index 00000000..409847b1
--- /dev/null
+++ b/inc/SP/Core/Exceptions/FileNotFoundException.class.php
@@ -0,0 +1,36 @@
+.
+ *
+ */
+
+namespace SP\Core\Exceptions;
+
+/**
+ * Class FileNotFoundException
+ *
+ * @package SP\Core\Exceptions
+ */
+class FileNotFoundException extends \Exception
+{
+
+}
\ No newline at end of file
diff --git a/inc/SP/Core/Init.class.php b/inc/SP/Core/Init.class.php
index 2ab1ce36..e8d38f7e 100644
--- a/inc/SP/Core/Init.class.php
+++ b/inc/SP/Core/Init.class.php
@@ -34,7 +34,6 @@ use SP\Http\Request;
use SP\Log\Email;
use SP\Log\Log;
use SP\Mgmt\Profiles\Profile;
-use SP\Mgmt\Profiles\ProfileUtil;
use SP\Storage\DBUtil;
use SP\Util\Checks;
use SP\Util\Util;
@@ -72,18 +71,18 @@ class Init
* @var bool True if sysPass has been updated. Only for notices.
*/
public static $UPDATED = false;
-
- /**
- * @var string
- */
- private static $SUBURI = '';
/**
* Estado de la BD
* 0 - Fail
* 1 - OK
+ *
* @var int
*/
- public static $DB_STATUS = 1;
+ public static $DB_STATUS = 0;
+ /**
+ * @var string
+ */
+ private static $SUBURI = '';
/**
* Inicializar la aplicación.
@@ -123,7 +122,7 @@ class Init
Language::setLanguage();
// Establecer el tema de sysPass
- Themes::setTheme();
+ DiFactory::getTheme();
// Comprobar si es necesario cambiar a HTTPS
self::checkHttps();
@@ -186,7 +185,7 @@ class Init
// Restablecer el idioma y el tema visual
Language::setLanguage();
- Themes::setTheme();
+// DiFactory::getTheme()->initTheme();
}
if (self::isLoggedIn() || Request::analyze('isAjax', false, true)) {
@@ -290,7 +289,7 @@ class Init
{
$Tpl = new Template();
$Tpl->append('errors', array('type' => SPException::SP_CRITICAL, 'description' => $str, 'hint' => $hint));
- $Controller = new Controller\Main($Tpl);
+ $Controller = new Controller\MainController($Tpl);
$Controller->getError(true);
$Controller->view();
exit;
@@ -417,18 +416,6 @@ class Init
}
}
- /**
- * Comprobar y forzar (si es necesario) la conexión HTTPS
- */
- private static function checkHttps()
- {
- if (Checks::forceHttpsIsEnabled() && !Checks::httpsEnabled()) {
- $port = ($_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : '';
- $fullUrl = 'https://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
- header('Location: ' . $fullUrl);
- }
- }
-
/**
* Comprobar el archivo que realiza el include necesita inicialización.
*
@@ -442,6 +429,18 @@ class Init
return (in_array($srcScript, $skipInit));
}
+ /**
+ * Comprobar y forzar (si es necesario) la conexión HTTPS
+ */
+ private static function checkHttps()
+ {
+ if (Checks::forceHttpsIsEnabled() && !Checks::httpsEnabled()) {
+ $port = ($_SERVER['SERVER_PORT'] != 443) ? ':' . $_SERVER['SERVER_PORT'] : '';
+ $fullUrl = 'https://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
+ header('Location: ' . $fullUrl);
+ }
+ }
+
/**
* Comprueba que la aplicación esté instalada
* Esta función comprueba si la aplicación está instalada. Si no lo está, redirige al instalador.
@@ -456,7 +455,7 @@ class Init
exit();
} else {
// Comprobar si sysPass está instalada o en modo mantenimiento
- $Controller = new Controller\Main();
+ $Controller = new Controller\MainController();
$Controller->getInstaller();
$Controller->view();
exit();
@@ -538,7 +537,7 @@ class Init
*/
private static function goLogin()
{
- $Controller = new Controller\Main(null, 'login');
+ $Controller = new Controller\MainController(null, 'login');
$Controller->getLogin();
$Controller->view();
exit;
@@ -559,34 +558,35 @@ class Init
if ($databaseVersion < $appVersion
&& Request::analyze('nodbupgrade', 0) === 0
+ && Upgrade::needDBUpgrade($databaseVersion)
) {
- if (Upgrade::needDBUpgrade($databaseVersion)) {
- if (!self::checkMaintenanceMode(true)) {
- if (empty(Config::getConfig()->getUpgradeKey())) {
- Config::getConfig()->setUpgradeKey(sha1(uniqid(mt_rand(), true)));
- Config::getConfig()->setMaintenance(true);
- Config::saveConfig();
- }
+ if (!self::checkMaintenanceMode(true)) {
+ $upgradeKey = Config::getConfig()->getUpgradeKey();
- self::initError(_('La aplicación necesita actualizarse'), sprintf(_('Si es un administrador pulse en el enlace: %s'), '' . _('Actualizar') . ''));
+ if (empty($upgradeKey)) {
+ Config::getConfig()->setUpgradeKey(sha1(uniqid(mt_rand(), true)));
+ Config::getConfig()->setMaintenance(true);
+ Config::saveConfig();
}
- $action = Request::analyze('a');
- $hash = Request::analyze('h');
+ self::initError(_('La aplicación necesita actualizarse'), sprintf(_('Si es un administrador pulse en el enlace: %s'), '' . _('Actualizar') . ''));
+ }
- if ($action === 'upgrade' && $hash === Config::getConfig()->getUpgradeKey()) {
- if ($update = Upgrade::doUpgrade($databaseVersion)) {
- ConfigDB::setValue('version', $appVersion);
- Config::getConfig()->setMaintenance(false);
- Config::getConfig()->setUpgradeKey('');
- Config::saveConfig();
- }
- } else {
- $controller = new Controller\Main();
- $controller->getUpgrade();
- $controller->view();
- exit();
+ $action = Request::analyze('a');
+ $hash = Request::analyze('h');
+
+ if ($action === 'upgrade' && $hash === Config::getConfig()->getUpgradeKey()) {
+ if ($update = Upgrade::doUpgrade($databaseVersion)) {
+ ConfigDB::setValue('version', $appVersion);
+ Config::getConfig()->setMaintenance(false);
+ Config::getConfig()->setUpgradeKey('');
+ Config::saveConfig();
}
+ } else {
+ $controller = new Controller\MainController();
+ $controller->getUpgrade();
+ $controller->view();
+ exit();
}
}
@@ -667,7 +667,7 @@ class Init
}
$action = Request::analyze('a');
- $Controller = new Controller\Main();
+ $Controller = new Controller\MainController();
switch ($action) {
case 'passreset':
@@ -744,7 +744,7 @@ class Init
}
$action = Request::analyze('a');
- $Controller = new Controller\Main(null, 'main');
+ $Controller = new Controller\MainController(null, 'main');
switch ($action) {
case 'accView':
diff --git a/inc/SP/Core/Installer.class.php b/inc/SP/Core/Installer.class.php
index 3f48dbba..5ae4593b 100644
--- a/inc/SP/Core/Installer.class.php
+++ b/inc/SP/Core/Installer.class.php
@@ -40,7 +40,6 @@ use SP\Mgmt\Groups\Group;
use SP\Mgmt\Profiles\Profile;
use SP\Mgmt\Users\User;
use SP\Mgmt\Users\UserPass;
-use SP\Storage\MySQLHandler;
use SP\Util\Util;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
@@ -208,22 +207,23 @@ class Installer
$this->InstallData->setDbUser(substr('sp_' . $this->InstallData->getAdminLogin(), 0, 16));
// Comprobar si el usuario sumistrado existe
- $query = /** @lang SQL */
- "SELECT COUNT(*) FROM mysql.user
- WHERE user='" . $this->InstallData->getDbUser() . "'
- AND host='" . $this->InstallData->getDbAuthHost() . "'";
+ $query = sprintf(/** @lang SQL */
+ 'SELECT COUNT(*) FROM mysql.user
+ WHERE user=\'%s\' AND host=\'%s\'',
+ $this->InstallData->getDbUser(),
+ $this->InstallData->getDbAuthHost());
try {
// Si no existe el usuario, se intenta crear
- if (intval($this->DB->query($query)->fetchColumn()) === 0) {
+ if ((int)$this->DB->query($query)->fetchColumn() === 0
// Se comprueba si el nuevo usuario es distinto del creado en otra instalación
- if ($this->InstallData->getDbUser() != Config::getConfig()->getDbUser()) {
- $this->createDBUser();
- }
+ && $this->InstallData->getDbUser() != Config::getConfig()->getDbUser()
+ ) {
+ $this->createDBUser();
}
} catch (PDOException $e) {
throw new SPException(SPException::SP_CRITICAL,
- _('No es posible comprobar el usuario de sysPass') . ' (' . $this->InstallData->getAdminLogin() . ')',
+ sprintf(_('No es posible comprobar el usuario de sysPass') . ' (%s)', $this->InstallData->getAdminLogin()),
_('Compruebe los permisos del usuario de conexión a la BD'));
}
}
@@ -253,15 +253,17 @@ class Installer
return;
}
- $query = /** @lang SQL */
- "CREATE USER '" . $this->InstallData->getDbUser() . "'@'" . $this->InstallData->getDbAuthHost() . "'
- IDENTIFIED BY '" . $this->InstallData->getDbPass() . "'";
+ $query = sprintf(/** @lang SQL */
+ 'CREATE USER \'%s\'@\'%s\' IDENTIFIED BY \'%s\'',
+ $this->InstallData->getDbUser(),
+ $this->InstallData->getDbAuthHost(),
+ $this->InstallData->getDbPass());
try {
$this->DB->query($query);
} catch (PDOException $e) {
throw new SPException(SPException::SP_CRITICAL,
- _('El usuario de MySQL ya existe') . " (" . $this->InstallData->getDbUser() . ")",
+ sprintf(_('El usuario de MySQL ya existe') . ' (%s)', $this->InstallData->getDbUser()),
_('Indique un nuevo usuario o elimine el existente'));
}
}
@@ -279,28 +281,30 @@ class Installer
_('Indique una nueva Base de Datos o elimine la existente'));
}
- $query = "CREATE SCHEMA `" . $this->InstallData->getDbName() . "`
- DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
+ $query = sprintf(/** @lang SQL */
+ 'CREATE SCHEMA `%s` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci', $this->InstallData->getDbName());
try {
$this->DB->query($query);
} catch (PDOException $e) {
- throw new SPException(SPException::SP_CRITICAL
- , _('Error al crear la BBDD') . " (" . $e->getMessage() . ")"
- , _('Verifique los permisos del usuario de la Base de Datos'));
+ throw new SPException(SPException::SP_CRITICAL,
+ sprintf(_('Error al crear la BBDD') . ' (%s)', $e->getMessage()),
+ _('Verifique los permisos del usuario de la Base de Datos'));
}
if (!$this->InstallData->isHostingMode()) {
- $query = /** @lang SQL */
- "GRANT ALL PRIVILEGES ON `" . $this->InstallData->getDbName() . "`.*
- TO '" . $this->InstallData->getDbUser() . "'@'" . $this->InstallData->getDbAuthHost() . "'
- IDENTIFIED BY '" . $this->InstallData->getDbPass() . "';";
+ $query = sprintf(/** @lang SQL */
+ 'GRANT ALL PRIVILEGES ON `%s`.* TO \'%s\'@\'%s\' IDENTIFIED BY \'%s\';',
+ $this->InstallData->getDbName(),
+ $this->InstallData->getDbUser(),
+ $this->InstallData->getDbAuthHost(),
+ $this->InstallData->getDbPass());
try {
$this->DB->query($query);
} catch (PDOException $e) {
throw new SPException(SPException::SP_CRITICAL,
- _('Error al establecer permisos de la BBDD') . " (" . $e->getMessage() . ")",
+ sprintf(_('Error al establecer permisos de la BBDD') . ' (%s)', $e->getMessage()),
_('Verifique los permisos del usuario de la Base de Datos'));
}
}
@@ -313,12 +317,12 @@ class Installer
*/
private function checkDatabaseExist()
{
- $query = /** @lang SQL */
- "SELECT COUNT(*)
+ $query = sprintf(/** @lang SQL */
+ 'SELECT COUNT(*)
FROM information_schema.schemata
- WHERE schema_name = '" . $this->InstallData->getDbName() . "' LIMIT 1";
+ WHERE schema_name = \'%s\' LIMIT 1', $this->InstallData->getDbName());
- return (intval($this->DB->query($query)->fetchColumn()) > 0);
+ return ((int)$this->DB->query($query)->fetchColumn() > 0);
}
/**
@@ -329,7 +333,7 @@ class Installer
*/
private function createDBStructure()
{
- $fileName = Init::$SERVERROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'dbstructure.sql';
+ $fileName = Init::$SERVERROOT . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . 'dbstructure.sql';
if (!file_exists($fileName)) {
throw new SPException(SPException::SP_CRITICAL,
@@ -342,7 +346,7 @@ class Installer
$this->DB->query('USE `' . $this->InstallData->getDbName() . '`');
} catch (PDOException $e) {
throw new SPException(SPException::SP_CRITICAL,
- _('Error al seleccionar la BBDD') . " '" . $this->InstallData->getDbName() . "' (" . $e->getMessage() . ")",
+ sprintf(_('Error al seleccionar la BBDD') . ' \'%s\' (%s)', $this->InstallData->getDbName(), $e->getMessage()),
_('No es posible usar la Base de Datos para crear la estructura. Compruebe los permisos y que no exista.'));
}
@@ -358,10 +362,10 @@ class Installer
$this->DB->query($query);
} catch (PDOException $e) {
// drop database on error
- $this->DB->query("DROP DATABASE IF EXISTS " . $this->InstallData->getDbName() . ";");
+ $this->DB->query('DROP DATABASE IF EXISTS ' . $this->InstallData->getDbName() . ';');
throw new SPException(SPException::SP_CRITICAL,
- _('Error al crear la BBDD') . ' (' . $e->getMessage() . ')',
+ sprintf(_('Error al crear la BBDD') . ' (%s)', $e->getMessage()),
_('Error al crear la estructura de la Base de Datos.'));
}
}
@@ -464,9 +468,9 @@ class Installer
private function rollback()
{
try {
- $this->DB->query("DROP DATABASE IF EXISTS " . $this->InstallData->getDbName() . ";");
- $this->DB->query("DROP USER '" . $this->InstallData->getDbUser() . "'@'" . $this->InstallData->getDbAuthHost() . "';");
- $this->DB->query("DROP USER '" . $this->InstallData->getDbUser() . "'@'%';");
+ $this->DB->query('DROP DATABASE IF EXISTS ' . $this->InstallData->getDbName() . ';');
+ $this->DB->query('DROP USER \'' . $this->InstallData->getDbUser() . '\'@\'' . $this->InstallData->getDbAuthHost() . '\';');
+ $this->DB->query('DROP USER \'' . $this->InstallData->getDbUser() . '\'@\'%\';');
} catch (PDOException $e) {
return false;
}
diff --git a/inc/SP/Core/ItemsTypeInterface.class.php b/inc/SP/Core/ItemsTypeInterface.class.php
new file mode 100644
index 00000000..a506682e
--- /dev/null
+++ b/inc/SP/Core/ItemsTypeInterface.class.php
@@ -0,0 +1,41 @@
+.
+ */
+
+namespace SP\Core;
+
+/**
+ * Interface ItemsTypeInterface para la definición de tipos de elementos
+ *
+ * @package SP\Core
+ */
+interface ItemsTypeInterface
+{
+ const ITEM_CATEGORIES = 1;
+ const ITEM_CUSTOMERS = 2;
+ const ITEM_FILES = 3;
+ const ITEM_TAGS = 4;
+ const ITEM_USERS = 5;
+ const ITEM_GROUPS = 6;
+ const ITEM_PROFILES = 7;
+}
\ No newline at end of file
diff --git a/inc/SP/Core/SessionUtil.class.php b/inc/SP/Core/SessionUtil.class.php
index ed344a8d..32bbda22 100644
--- a/inc/SP/Core/SessionUtil.class.php
+++ b/inc/SP/Core/SessionUtil.class.php
@@ -25,6 +25,7 @@
namespace SP\Core;
+use SP\Config\Config;
use SP\DataModel\UserData;
use SP\Mgmt\Profiles\Profile;
use SP\Mgmt\Profiles\ProfileUtil;
@@ -105,11 +106,12 @@ class SessionUtil
*/
public static function getSessionKey($new = false)
{
- $hash = sha1(time());
-
// Generamos un nuevo hash si es necesario y lo guardamos en la sesión
- if (is_null(Session::getSecurityKey()) || $new === true) {
+ if ($new === true || null === Session::getSecurityKey()) {
+ $hash = sha1(time() . Config::getConfig()->getPasswordSalt());
+
Session::setSecurityKey($hash);
+
return $hash;
}
@@ -124,7 +126,7 @@ class SessionUtil
*/
public static function checkSessionKey($key)
{
- return (!is_null(Session::getSecurityKey()) && Session::getSecurityKey() == $key);
+ return (null !== Session::getSecurityKey() && Session::getSecurityKey() === $key);
}
/**
diff --git a/inc/SP/Core/Template.class.php b/inc/SP/Core/Template.class.php
index 4318049e..1162dbcf 100644
--- a/inc/SP/Core/Template.class.php
+++ b/inc/SP/Core/Template.class.php
@@ -28,6 +28,8 @@ namespace SP\Core;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
use InvalidArgumentException;
+use SP\Core\Exceptions\FileNotFoundException;
+use SP\Core\UI\ThemeInterface;
use SP\Log\Log;
/**
@@ -41,14 +43,22 @@ use SP\Log\Log;
*/
class Template
{
+ /**
+ * @var ThemeInterface
+ */
+ protected $Theme;
/**
* @var array Variable con los archivos de plantilla a cargar
*/
- private $file = array();
+ private $file = [];
/**
* @var array Variable con las variables a incluir en la plantilla
*/
- private $vars = array();
+ private $vars = [];
+ /**
+ * @var string Directorio base para los archivos de plantillas
+ */
+ private $base;
/**
* @param null $file Archivo de plantilla a añadir
@@ -56,25 +66,28 @@ class Template
*/
public function __construct($file = null, array $vars = array())
{
- if (!is_null($file)) {
+ if (null !== $file) {
$this->addTemplate($file);
}
if (!empty($vars)) {
$this->setVars($vars);
}
+
+ $this->Theme = DiFactory::getTheme();
}
/**
* Añadir una nueva plantilla al array de plantillas de la clase
*
* @param string $file Con el nombre del archivo de plantilla
+ * @param string $base Directorio base para la plantilla
* @return bool
*/
- public function addTemplate($file)
+ public function addTemplate($file, $base = null)
{
try {
- $template = $this->checkTemplate($file);
+ $template = $this->checkTemplate($file, $base);
$this->setTemplate($template);
} catch (InvalidArgumentException $e) {
return false;
@@ -83,38 +96,34 @@ class Template
return true;
}
- /**
- * Añadir una nueva plantilla dentro de una plantilla
- *
- * @param string $file Con el nombre del archivo de plantilla
- * @return bool
- */
- public function includeTemplate($file)
- {
- try {
- $template = $this->checkTemplate($file);
- return $template;
- } catch (InvalidArgumentException $e) {
- return false;
- }
- }
-
/**
* Comprobar si un archivo de plantilla existe y se puede leer
*
- * @param string $file Con el nombre del archivo
+ * @param string $template Con el nombre del archivo
* @return string La ruta al archivo de la plantilla
+ * @param string $base Directorio base para la plantilla
+ * @throws \InvalidArgumentException
*/
- private function checkTemplate($file)
+ private function checkTemplate($template, $base = null)
{
- $template = VIEW_PATH . DIRECTORY_SEPARATOR . Themes::$theme . DIRECTORY_SEPARATOR . $file . '.inc';
+ if (null !== $base) {
+ $template = $base . DIRECTORY_SEPARATOR . $template . '.inc';
+ } elseif (null !== $this->base) {
+ $template = $this->base . DIRECTORY_SEPARATOR . $template . '.inc';
+ } else {
+ $template .= '.inc';
+ }
- if (!is_readable($template)) {
+ error_log('Plantilla: ' . $template);
+
+ $file = $this->Theme->getViewsPath() . DIRECTORY_SEPARATOR . $template;
+
+ if (!is_readable($file)) {
Log::writeNewLog(__FUNCTION__, sprintf(_('No es posible obtener la plantilla "%s" : %s'), $file, $template), Log::ERROR);
throw new InvalidArgumentException(sprintf(_('No es posible obtener la plantilla "%s" : %s'), $file, $template));
}
- return $template;
+ return $file;
}
/**
@@ -139,6 +148,22 @@ class Template
}
}
+ /**
+ * Añadir una nueva plantilla dentro de una plantilla
+ *
+ * @param string $file Con el nombre del archivo de plantilla
+ * @param string $base Directorio base para la plantilla
+ * @return bool
+ */
+ public function includeTemplate($file, $base = null)
+ {
+ try {
+ return $this->checkTemplate($file, $base);
+ } catch (InvalidArgumentException $e) {
+ return false;
+ }
+ }
+
/**
* Overloading para controlar la devolución de atributos dinámicos.
*
@@ -191,7 +216,7 @@ class Template
*/
public function __unset($name)
{
- if (!isset($this->vars[$name])) {
+ if (!array_key_exists($name, $this->vars)) {
throw new InvalidArgumentException(sprintf(_('No es posible destruir la variable "%s"'), $name));
}
@@ -204,9 +229,14 @@ class Template
* La salida se almacena en buffer y se devuelve el contenido
*
* @return string Con el contenido del buffer de salida
+ * @throws FileNotFoundException
*/
public function render()
{
+ if (count($this->file) === 0) {
+ throw new FileNotFoundException(_('La plantilla no contiene archivos'));
+ }
+
extract($this->vars);
ob_start();
@@ -228,7 +258,7 @@ class Template
*/
public function assign($name, $value = '', $scope = null)
{
- if (!is_null($scope)) {
+ if (null !== $scope) {
$name = $scope . '_' . $name;
}
@@ -245,11 +275,11 @@ class Template
*/
public function append($name, $value, $scope = null, $index = null)
{
- if (!is_null($scope)) {
+ if (null !== $scope) {
$name = $scope . '_' . $name;
}
- if (!is_null($index)) {
+ if (null !== $index) {
$this->vars[$name][$index] = $value;
} else {
$this->vars[$name][] = $value;
@@ -271,4 +301,20 @@ class Template
{
$this->vars = array();
}
+
+ /**
+ * @return string
+ */
+ public function getBase()
+ {
+ return $this->base;
+ }
+
+ /**
+ * @param string $base
+ */
+ public function setBase($base)
+ {
+ $this->base = $base;
+ }
}
\ No newline at end of file
diff --git a/inc/SP/Core/Themes.class.php b/inc/SP/Core/Themes.class.php
deleted file mode 100644
index 471eb617..00000000
--- a/inc/SP/Core/Themes.class.php
+++ /dev/null
@@ -1,187 +0,0 @@
-.
- *
- */
-
-namespace SP\Core;
-
-use SP\Config\Config;
-use SP\Mgmt\Users\UserPreferences;
-use Theme\Icons;
-
-defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
-
-/**
- * Class Themes para el manejo de los temas visuales
- *
- * @package SP
- */
-class Themes
-{
- /**
- * @var string
- */
- public static $themeUri = '';
- /**
- * @var string
- */
- public static $themePath = '';
- /**
- * @var string
- */
- public static $theme = '';
- /** @var
- * Icons
- */
- private static $icons;
-
- /**
- * Obtener los temas disponibles desde el directorio de temas
- *
- * @return array Con la información del tema
- */
- public static function getThemesAvailable()
- {
- $themesAvailable = array();
-
- $dirThemes = dir(VIEW_PATH);
-
- while (false !== ($theme = $dirThemes->read())) {
- if ($theme != '.' && $theme != '..') {
- $themeFile = VIEW_PATH . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'index.php';
-
- if (file_exists($themeFile)) {
- include $themeFile;
-
- $themesAvailable[$theme] = $themeInfo['name'];
- }
- }
- }
-
- $dirThemes->close();
-
- return $themesAvailable;
- }
-
- /**
- * Obtener la información del tema desde el archivo de información
- *
- * @return array
- *
- */
- public static function getThemeInfo()
- {
- if (self::$themePath === '') {
- self::setTheme();
- }
-
- $themeFile = Init::$SERVERROOT . self::$themePath . DIRECTORY_SEPARATOR . 'index.php';
- $themeInfo = array();
-
- if (file_exists($themeFile)) {
- include $themeFile;
- }
-
- return $themeInfo;
- }
-
- /**
- * Establecer el tema visual a utilizar
- *
- * @param bool $force Forzar la detección del tema para los inicios de sesión
- */
- public static function setTheme($force = false)
- {
- $theme = Session::getTheme();
-
- if (empty($theme) || $force === true) {
- $Theme = new Themes();
-
- $userTheme = $Theme->getUserTheme();
- $globalTheme = $Theme->getGlobalTheme();
-
- $theme = ($userTheme) ? $userTheme : $globalTheme;
-
- Session::setTheme($theme);
- }
-
- self::setThemePaths($theme);
- Session::setTheme($theme);
- }
-
- /**
- * Obtener el tema visual del usuario
- *
- * @return string
- */
- private function getUserTheme()
- {
- return (Session::getUserId() > 0) ? UserPreferences::getItem()->getById(Session::getUserId())->getItemData()->getTheme() : '';
- }
-
- /**
- * Devolver el tema visual de sysPass desde la configuración
- */
- private function getGlobalTheme()
- {
- self::$theme = Config::getConfig()->getSiteTheme();
-
- return self::$theme;
- }
-
- /**
- * Establecer las variables de rutas para el tema visual
- *
- * @param string $theme El tema a utilizar
- */
- private static function setThemePaths($theme)
- {
- self::$theme = $theme;
- self::$themeUri = Init::$WEBURI . '/inc/themes/' . $theme;
- self::$themePath = DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme;
- }
-
- /**
- * Obtener los iconos del tema actual
- *
- * @return Icons
- */
- public static function getIcons()
- {
- if (self::$themePath === '') {
- self::setTheme();
- }
-
- if (!self::$icons instanceof Icons) {
- $iconsClass = Init::$SERVERROOT . self::$themePath . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Icons.class.php';
-
- if (file_exists($iconsClass)) {
- include_once $iconsClass;
-
- self::$icons = new Icons();
- }
- }
-
- return self::$icons;
- }
-}
\ No newline at end of file
diff --git a/inc/SP/Core/UI/Theme.class.php b/inc/SP/Core/UI/Theme.class.php
new file mode 100644
index 00000000..eac43eab
--- /dev/null
+++ b/inc/SP/Core/UI/Theme.class.php
@@ -0,0 +1,226 @@
+.
+ *
+ */
+
+namespace SP\Core\UI;
+
+use SP\Config\Config;
+use SP\Core\Init;
+use SP\Core\Session;
+use SP\Mgmt\Users\UserPreferences;
+use Theme\Icons;
+
+defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
+
+/**
+ * Class Theme
+ *
+ * @package SP
+ */
+class Theme implements ThemeInterface
+{
+ /**
+ * @var string
+ */
+ protected $themeUri = '';
+ /**
+ * @var string
+ */
+ protected $themePath = '';
+ /**
+ * @var string
+ */
+ protected $themePathFull = '';
+ /**
+ * @var string
+ */
+ protected $themeName = '';
+ /**
+ * @var string
+ */
+ protected $viewsPath = '';
+ /**
+ * @var ThemeIconsInterface
+ */
+ protected $icons;
+
+ /**
+ * Theme constructor.
+ */
+ public function __construct()
+ {
+ $this->initTheme();
+ $this->initIcons();
+ }
+
+ /**
+ * Inicializar el tema visual a utilizar
+ *
+ * @param bool $force Forzar la detección del tema para los inicios de sesión
+ * @return void
+ */
+ public function initTheme($force = false)
+ {
+ $this->themeName = Session::getTheme();
+
+ if (empty($this->themeName) || $force === true) {
+ $this->themeName = $this->getUserTheme() ?: $this->getGlobalTheme();
+ Session::setTheme($this->themeName);
+ }
+
+ $this->themeUri = Init::$WEBURI . '/inc/themes/' . $this->themeName;
+ $this->themePath = DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $this->themeName;
+ $this->themePathFull = Init::$SERVERROOT . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $this->themeName;
+ $this->viewsPath = $this->themePathFull . DIRECTORY_SEPARATOR . 'views';
+ }
+
+ /**
+ * Obtener el tema visual del usuario
+ *
+ * @return string
+ */
+ protected function getUserTheme()
+ {
+ return (Session::getUserId() > 0) ? UserPreferences::getItem()->getById(Session::getUserId())->getItemData()->getTheme() : '';
+ }
+
+ /**
+ * Devolver el tema visual de sysPass desde la configuración
+ */
+ protected function getGlobalTheme()
+ {
+ $this->themeName = Config::getConfig()->getSiteTheme();
+
+ return $this->themeName;
+ }
+
+ /**
+ * Inicializar los iconos del tema actual
+ *
+ * @return ThemeIconsInterface
+ */
+ protected function initIcons()
+ {
+ $iconsClass = $this->themePathFull . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'Icons.class.php';
+
+ if (file_exists($iconsClass)) {
+ include_once $iconsClass;
+
+ $this->icons = new Icons();
+ }
+
+ return $this->icons;
+ }
+
+ /**
+ * Obtener los temas disponibles desde el directorio de temas
+ *
+ * @return array Con la información del tema
+ */
+ public function getThemesAvailable()
+ {
+ $themesAvailable = array();
+
+ $themesDirs = dir(VIEW_PATH);
+
+ while (false !== ($themeDir = $themesDirs->read())) {
+ if ($themeDir != '.' && $themeDir != '..') {
+ $themeFile = VIEW_PATH . DIRECTORY_SEPARATOR . $themeDir . DIRECTORY_SEPARATOR . 'index.php';
+
+ if (file_exists($themeFile)) {
+ include $themeFile;
+
+ $themesAvailable[$themeDir] = $themeInfo['name'];
+ }
+ }
+ }
+
+ $themesDirs->close();
+
+ return $themesAvailable;
+ }
+
+ /**
+ * Obtener la información del tema desde el archivo de información
+ *
+ * @return array (
+ * 'name' => string
+ * 'creator' => string
+ * 'version' => string
+ * 'js' => array
+ * 'css' => array
+ * )
+ */
+ public function getThemeInfo()
+ {
+ $themeFile = $this->themePathFull . DIRECTORY_SEPARATOR . 'index.php';
+ $themeInfo = array();
+
+ if (file_exists($themeFile)) {
+ include $themeFile;
+ }
+
+ return $themeInfo;
+ }
+
+ /**
+ * @return string
+ */
+ public function getThemeUri()
+ {
+ return $this->themeUri;
+ }
+
+ /**
+ * @return string
+ */
+ public function getThemePath()
+ {
+ return $this->themePath;
+ }
+
+ /**
+ * @return string
+ */
+ public function getThemeName()
+ {
+ return $this->themeName;
+ }
+
+ /**
+ * @return ThemeIconsInterface
+ */
+ public function getIcons()
+ {
+ return $this->icons;
+ }
+
+ /**
+ * @return string
+ */
+ public function getViewsPath()
+ {
+ return $this->viewsPath;
+ }
+}
\ No newline at end of file
diff --git a/inc/SP/Core/ThemeIconsBase.class.php b/inc/SP/Core/UI/ThemeIconsBase.class.php
similarity index 97%
rename from inc/SP/Core/ThemeIconsBase.class.php
rename to inc/SP/Core/UI/ThemeIconsBase.class.php
index 990f325c..ecaaa2fa 100644
--- a/inc/SP/Core/ThemeIconsBase.class.php
+++ b/inc/SP/Core/UI/ThemeIconsBase.class.php
@@ -23,7 +23,7 @@
*
*/
-namespace SP\Core;
+namespace SP\Core\UI;
use SP\Html\Assets\FontIcon;
use SP\Html\Assets\ImageIcon;
@@ -97,6 +97,8 @@ abstract class ThemeIconsBase implements ThemeIconsInterface
protected $iconDownload;
/** @var FontIcon|ImageIcon */
protected $iconWarning;
+ /** @var FontIcon|ImageIcon */
+ protected $iconCheck;
/**
* Icons constructor.
@@ -345,4 +347,12 @@ abstract class ThemeIconsBase implements ThemeIconsInterface
{
return $this->iconOptional;
}
+
+ /**
+ * @return FontIcon|ImageIcon
+ */
+ public function getIconCheck()
+ {
+ return $this->iconCheck;
+ }
}
\ No newline at end of file
diff --git a/inc/SP/Core/ThemeIconsInterface.class.php b/inc/SP/Core/UI/ThemeIconsInterface.class.php
similarity index 97%
rename from inc/SP/Core/ThemeIconsInterface.class.php
rename to inc/SP/Core/UI/ThemeIconsInterface.class.php
index 1685c82f..83202a82 100644
--- a/inc/SP/Core/ThemeIconsInterface.class.php
+++ b/inc/SP/Core/UI/ThemeIconsInterface.class.php
@@ -23,7 +23,7 @@
*
*/
-namespace SP\Core;
+namespace SP\Core\UI;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
diff --git a/inc/SP/Core/UI/ThemeInterface.class.php b/inc/SP/Core/UI/ThemeInterface.class.php
new file mode 100644
index 00000000..8893646a
--- /dev/null
+++ b/inc/SP/Core/UI/ThemeInterface.class.php
@@ -0,0 +1,85 @@
+.
+ *
+ */
+
+namespace SP\Core\UI;
+
+/**
+ * Interface ThemeInterface
+ *
+ * @package SP\Core\UI
+ */
+interface ThemeInterface
+{
+ /**
+ * @param bool $force Forzar la detección del tema para los inicios de sesión
+ * @return mixed
+ */
+ public function initTheme($force = false);
+
+ /**
+ * Obtener los temas disponibles desde el directorio de temas
+ *
+ * @return array Con la información del tema
+ */
+ public function getThemesAvailable();
+
+ /**
+ * Obtener la información del tema desde el archivo de información
+ *
+ * @return array (
+ * 'name' => string
+ * 'creator' => string
+ * 'version' => string
+ * 'js' => array
+ * 'css' => array
+ * )
+ */
+ public function getThemeInfo();
+
+ /**
+ * @return string
+ */
+ public function getThemeUri();
+
+ /**
+ * @return string
+ */
+ public function getThemePath();
+
+ /**
+ * @return string
+ */
+ public function getThemeName();
+
+ /**
+ * @return ThemeIconsInterface
+ */
+ public function getIcons();
+
+ /**
+ * @return string
+ */
+ public function getViewsPath();
+}
\ No newline at end of file
diff --git a/inc/SP/DataModel/AccountData.class.php b/inc/SP/DataModel/AccountData.class.php
index 3a7013a7..ce9010aa 100644
--- a/inc/SP/DataModel/AccountData.class.php
+++ b/inc/SP/DataModel/AccountData.class.php
@@ -129,7 +129,7 @@ class AccountData implements JsonSerializable
*/
public function __construct($accountId = 0)
{
- $this->accountId = $accountId;
+ $this->accountId = (int)$accountId;
}
/**
@@ -145,7 +145,7 @@ class AccountData implements JsonSerializable
*/
public function setDateAdd($dateAdd)
{
- $this->dateAdd = $dateAdd;
+ $this->dateAdd = (int)$dateAdd;
}
/**
@@ -161,7 +161,7 @@ class AccountData implements JsonSerializable
*/
public function setDateEdit($dateEdit)
{
- $this->dateEdit = $dateEdit;
+ $this->dateEdit = (int)$dateEdit;
}
/**
@@ -177,7 +177,7 @@ class AccountData implements JsonSerializable
*/
public function setIsModify($isModify)
{
- $this->isModify = $isModify;
+ $this->isModify = (int)$isModify;
}
/**
@@ -193,7 +193,7 @@ class AccountData implements JsonSerializable
*/
public function setIsDeleted($isDeleted)
{
- $this->isDeleted = $isDeleted;
+ $this->isDeleted = (int)$isDeleted;
}
/**
@@ -209,7 +209,7 @@ class AccountData implements JsonSerializable
*/
public function setAccountUserEditId($accountUserEditId)
{
- $this->accountUserEditId = $accountUserEditId;
+ $this->accountUserEditId = (int)$accountUserEditId;
}
/**
@@ -273,7 +273,7 @@ class AccountData implements JsonSerializable
*/
public function setAccountUserId($accountUserId)
{
- $this->accountUserId = $accountUserId;
+ $this->accountUserId = (int)$accountUserId;
}
/**
@@ -289,7 +289,7 @@ class AccountData implements JsonSerializable
*/
public function setAccountUserGroupId($accountUserGroupId)
{
- $this->accountUserGroupId = $accountUserGroupId;
+ $this->accountUserGroupId = (int)$accountUserGroupId;
}
/**
@@ -297,7 +297,7 @@ class AccountData implements JsonSerializable
*/
public function getAccountOtherUserEdit()
{
- return intval($this->accountOtherUserEdit);
+ return $this->accountOtherUserEdit;
}
/**
@@ -305,7 +305,7 @@ class AccountData implements JsonSerializable
*/
public function setAccountOtherUserEdit($accountOtherUserEdit)
{
- $this->accountOtherUserEdit = $accountOtherUserEdit;
+ $this->accountOtherUserEdit = (int)$accountOtherUserEdit;
}
/**
@@ -313,7 +313,7 @@ class AccountData implements JsonSerializable
*/
public function getAccountOtherGroupEdit()
{
- return intval($this->accountOtherGroupEdit);
+ return $this->accountOtherGroupEdit;
}
/**
@@ -321,7 +321,7 @@ class AccountData implements JsonSerializable
*/
public function setAccountOtherGroupEdit($accountOtherGroupEdit)
{
- $this->accountOtherGroupEdit = $accountOtherGroupEdit;
+ $this->accountOtherGroupEdit = (int)$accountOtherGroupEdit;
}
/**
@@ -329,7 +329,7 @@ class AccountData implements JsonSerializable
*/
public function getAccountUserGroupsId()
{
- return (is_array($this->accountUserGroupsId)) ? $this->accountUserGroupsId : [];
+ return is_array($this->accountUserGroupsId) ? $this->accountUserGroupsId : [];
}
/**
@@ -385,7 +385,7 @@ class AccountData implements JsonSerializable
*/
public function setAccountCategoryId($accountCategoryId)
{
- $this->accountCategoryId = $accountCategoryId;
+ $this->accountCategoryId = (int)$accountCategoryId;
}
/**
@@ -401,7 +401,7 @@ class AccountData implements JsonSerializable
*/
public function setAccountCustomerId($accountCustomerId)
{
- $this->accountCustomerId = $accountCustomerId;
+ $this->accountCustomerId = (int)$accountCustomerId;
}
/**
@@ -460,12 +460,11 @@ class AccountData implements JsonSerializable
* which is a value of any type other than a resource.
* @since 5.4.0
*/
- function jsonSerialize()
+ public function jsonSerialize()
{
$data = get_object_vars($this);
- unset($data['accountPass']);
- unset($data['accountIV']);
+ unset($data['accountPass'], $data['accountIV']);
return Json::safeJson($data);
}
diff --git a/inc/SP/DataModel/CategoryData.class.php b/inc/SP/DataModel/CategoryData.class.php
index ef7e36eb..458ab889 100644
--- a/inc/SP/DataModel/CategoryData.class.php
+++ b/inc/SP/DataModel/CategoryData.class.php
@@ -32,7 +32,7 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
*
* @package SP\DataModel
*/
-class CategoryData
+class CategoryData extends DataModelBase
{
/**
* @var int
@@ -110,4 +110,20 @@ class CategoryData
{
$this->category_description = $category_description;
}
+
+ /**
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->category_id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->category_name;
+ }
}
\ No newline at end of file
diff --git a/inc/SP/DataModel/CustomerData.class.php b/inc/SP/DataModel/CustomerData.class.php
index 40e923fa..1b9bc91f 100644
--- a/inc/SP/DataModel/CustomerData.class.php
+++ b/inc/SP/DataModel/CustomerData.class.php
@@ -32,7 +32,7 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
*
* @package SP\DataModel
*/
-class CustomerData
+class CustomerData extends DataModelBase
{
/**
* @var int
@@ -120,4 +120,20 @@ class CustomerData
{
return $this->customer_hash;
}
+
+ /**
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->customer_id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->customer_name;
+ }
}
\ No newline at end of file
diff --git a/inc/SP/DataModel/DataModelBase.class.php b/inc/SP/DataModel/DataModelBase.class.php
new file mode 100644
index 00000000..be1e442b
--- /dev/null
+++ b/inc/SP/DataModel/DataModelBase.class.php
@@ -0,0 +1,35 @@
+.
+ */
+
+namespace SP\DataModel;
+
+/**
+ * Class DataModelBase
+ *
+ * @package SP\DataModel
+ */
+abstract class DataModelBase implements DataModelInterface
+{
+
+}
\ No newline at end of file
diff --git a/inc/SP/DataModel/DataModelInterface.class.php b/inc/SP/DataModel/DataModelInterface.class.php
new file mode 100644
index 00000000..9a6f877a
--- /dev/null
+++ b/inc/SP/DataModel/DataModelInterface.class.php
@@ -0,0 +1,44 @@
+.
+ */
+
+namespace SP\DataModel;
+
+
+/**
+ * Interface DataModelInterface
+ *
+ * @package SP\DataModel
+ */
+interface DataModelInterface
+{
+ /**
+ * @return int
+ */
+ public function getId();
+
+ /**
+ * @return string
+ */
+ public function getName();
+}
\ No newline at end of file
diff --git a/inc/SP/Html/DataGrid/DataGridActionBase.class.php b/inc/SP/Html/DataGrid/DataGridActionBase.class.php
index f5585780..1c1f91f5 100644
--- a/inc/SP/Html/DataGrid/DataGridActionBase.class.php
+++ b/inc/SP/Html/DataGrid/DataGridActionBase.class.php
@@ -102,6 +102,22 @@ abstract class DataGridActionBase implements DataGridActionInterface
* @var int
*/
private $_type = 0;
+ /**
+ * Atributos de datos adicionales
+ *
+ * @var array
+ */
+ private $_data = [];
+
+ /**
+ * DataGridActionBase constructor.
+ *
+ * @param int $id EL id de la acción
+ */
+ public function __construct($id = null)
+ {
+ $this->_id = $id;
+ }
/**
* Devolver el método reflexivo que determina si se muestra la acción
@@ -217,7 +233,7 @@ abstract class DataGridActionBase implements DataGridActionInterface
$args[] = (!is_numeric($arg) && $arg !== 'this') ? '\'' . $arg . '\'' : $arg;
}
- return $this->_onClickFunction . '(' . implode(',', $args) . ')';
+ return count($args) > 0 ? $this->_onClickFunction . '(' . implode(',', $args) . ')' : $this->_onClickFunction;
}
/**
@@ -314,4 +330,37 @@ abstract class DataGridActionBase implements DataGridActionInterface
return $this;
}
+
+ /**
+ * @return array
+ */
+ public function getData()
+ {
+ return $this->_data;
+ }
+
+ /**
+ * @param array $data Los datos de los atributos
+ * @return $this
+ */
+ public function setData(array $data)
+ {
+ $this->_data = $data;
+
+ return $this;
+ }
+
+ /**
+ * Añadir nuevo atributo de datos
+ *
+ * @param string $name El nombe del atributo
+ * @param mixed $data Los datos del atributo
+ * @return $this
+ */
+ public function addData($name, $data)
+ {
+ $this->_data[$name] = $data;
+
+ return $this;
+ }
}
diff --git a/inc/SP/Html/DataGrid/DataGridActionInterface.class.php b/inc/SP/Html/DataGrid/DataGridActionInterface.class.php
index 087f1d6c..d3693335 100644
--- a/inc/SP/Html/DataGrid/DataGridActionInterface.class.php
+++ b/inc/SP/Html/DataGrid/DataGridActionInterface.class.php
@@ -130,4 +130,25 @@ interface DataGridActionInterface
* @return int El tipo de acción
*/
public function getType();
+
+ /**
+ * @return array
+ */
+ public function getData();
+
+ /**
+ * Establecer atributos de datos
+ *
+ * @param array $data Los datos de los atributos
+ * @return $this
+ */
+ public function setData(array $data);
+
+ /**
+ * Añadir nuevo atributo de datos
+ *
+ * @param string $name El nombe del atributo
+ * @param mixed $data Los datos del atributo
+ */
+ public function addData($name, $data);
}
diff --git a/inc/SP/Html/DataGrid/DataGridActionSearch.class.php b/inc/SP/Html/DataGrid/DataGridActionSearch.class.php
index bd710d4c..3fd9823c 100644
--- a/inc/SP/Html/DataGrid/DataGridActionSearch.class.php
+++ b/inc/SP/Html/DataGrid/DataGridActionSearch.class.php
@@ -48,9 +48,13 @@ class DataGridActionSearch extends DataGridActionBase
/**
* DataGridActionSearch constructor.
+ *
+ * @param int $id EL id de la acción
*/
- public function __construct()
+ public function __construct($id = null)
{
+ parent::__construct($id);
+
$this->setSkip(true);
}
@@ -65,7 +69,7 @@ class DataGridActionSearch extends DataGridActionBase
$args[] = (!is_numeric($arg) && $arg !== 'this') ? '\'' . $arg . '\'' : $arg;
}
- return 'return ' . $this->_onSubmitFunction . '(' . implode(',', $args) . ');';
+ return count($args) > 0 ? 'return ' . $this->_onSubmitFunction . '(' . implode(',', $args) . ');' : $this->_onSubmitFunction;
}
/**
diff --git a/inc/SP/Html/DataGrid/DataGridBase.class.php b/inc/SP/Html/DataGrid/DataGridBase.class.php
index 507df5ea..7186c136 100644
--- a/inc/SP/Html/DataGrid/DataGridBase.class.php
+++ b/inc/SP/Html/DataGrid/DataGridBase.class.php
@@ -29,7 +29,8 @@ defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'
use InvalidArgumentException;
use SP\Core\ActionsInterface;
-use SP\Core\Themes;
+use SP\Core\DiFactory;
+use SP\Core\Theme;
use SplObjectStorage;
/**
@@ -74,7 +75,7 @@ abstract class DataGridBase implements DataGridInterface
*
* @var DataGridActionInterface[]
*/
- private $_actions = null;
+ private $_actions;
/**
* La acción a realizar al cerrar la matriz
*
@@ -82,25 +83,25 @@ abstract class DataGridBase implements DataGridInterface
*/
private $_onCloseAction = 0;
/**
- * La pantilla a utilizar para presentar la cabecera
+ * La plantilla a utilizar para presentar la cabecera
*
* @var string
*/
private $_headerTemplate;
/**
- * La pantilla a utilizar para presentar las acciones
+ * La plantilla a utilizar para presentar las acciones
*
* @var string
*/
private $_actionsTemplate;
/**
- * La pantilla a utilizar para presentar el paginador
+ * La plantilla a utilizar para presentar el paginador
*
* @var string
*/
private $_pagerTemplate;
/**
- * La pantilla a utilizar para presentar los datos
+ * La plantilla a utilizar para presentar los datos
*
* @var string
*/
@@ -188,7 +189,7 @@ abstract class DataGridBase implements DataGridInterface
*/
public function setDataActions(DataGridActionInterface $action)
{
- if (is_null($this->_actions)) {
+ if (null === $this->_actions) {
$this->_actions = new SplObjectStorage();
}
@@ -198,7 +199,7 @@ abstract class DataGridBase implements DataGridInterface
}
/**
- * @return DataGridAction[]
+ * @return DataGridActionInterface[]
*/
public function getDataActions()
{
@@ -217,11 +218,12 @@ abstract class DataGridBase implements DataGridInterface
* Establecer la plantilla utilizada para la cabecera
*
* @param string $template El nombre de la plantilla a utilizar
+ * @param string $base Directorio base para la plantilla
* @return $this
*/
- public function setDataHeaderTemplate($template)
+ public function setDataHeaderTemplate($template, $base = null)
{
- $this->_headerTemplate = $this->checkTemplate($template);
+ $this->_headerTemplate = $this->checkTemplate($template, $base);
return $this;
}
@@ -229,12 +231,15 @@ abstract class DataGridBase implements DataGridInterface
/**
* Comprobar si existe una plantilla y devolver la ruta completa
*
- * @param $template
+ * @param $template
+ * @param null $base
* @return string
+ * @throws \InvalidArgumentException
*/
- protected function checkTemplate($template)
+ protected function checkTemplate($template, $base = null)
{
- $file = VIEW_PATH . DIRECTORY_SEPARATOR . Themes::$theme . DIRECTORY_SEPARATOR . $template . '.inc';
+ $template = null === $base ? $template . '.inc' : $base . DIRECTORY_SEPARATOR . $template . '.inc';
+ $file = DiFactory::getTheme()->getViewsPath() . DIRECTORY_SEPARATOR . $template;
if (!is_readable($file)) {
throw new InvalidArgumentException(sprintf(_('No es posible obtener la plantilla "%s" : %s'), $template, $file));
@@ -258,6 +263,7 @@ abstract class DataGridBase implements DataGridInterface
*
* @param string $template El nombre de la plantilla a utilizar
* @return $this
+ * @throws \InvalidArgumentException
*/
public function setDataActionsTemplate($template)
{
@@ -280,11 +286,12 @@ abstract class DataGridBase implements DataGridInterface
* Establecer la plantilla utilizada para el paginador
*
* @param string $template El nombre de la plantilla a utilizar
+ * @param string $base Directorio base para la plantilla
* @return $this
*/
- public function setDataPagerTemplate($template)
+ public function setDataPagerTemplate($template, $base = null)
{
- $this->_pagerTemplate = $this->checkTemplate($template);
+ $this->_pagerTemplate = $this->checkTemplate($template, $base);
return $this;
}
@@ -301,12 +308,12 @@ abstract class DataGridBase implements DataGridInterface
/**
* @param string $template El nombre de la plantilla a utilizar
+ * @param string $base Directorio base para la plantilla
* @return mixed
- * @throws InvalidArgumentException
*/
- public function setDataRowTemplate($template)
+ public function setDataRowTemplate($template, $base = null)
{
- $this->_rowsTemplate = $this->checkTemplate($template);
+ $this->_rowsTemplate = $this->checkTemplate($template, $base);
return $this;
}
diff --git a/inc/SP/Html/DataGrid/DataGridPagerBase.class.php b/inc/SP/Html/DataGrid/DataGridPagerBase.class.php
index 7e406794..9632dfc4 100644
--- a/inc/SP/Html/DataGrid/DataGridPagerBase.class.php
+++ b/inc/SP/Html/DataGrid/DataGridPagerBase.class.php
@@ -478,4 +478,12 @@ abstract class DataGridPagerBase implements DataGridPagerInterface
{
return ($this->_limitStart - $this->_limitCount);
}
+
+ /**
+ * @return DataGridActionSearch
+ */
+ public function getSourceAction()
+ {
+ return $this->_sourceAction;
+ }
}
\ No newline at end of file
diff --git a/inc/SP/Html/DataGrid/DataGridPagerInterface.class.php b/inc/SP/Html/DataGrid/DataGridPagerInterface.class.php
index e3639bdb..68f820f8 100644
--- a/inc/SP/Html/DataGrid/DataGridPagerInterface.class.php
+++ b/inc/SP/Html/DataGrid/DataGridPagerInterface.class.php
@@ -209,4 +209,29 @@ interface DataGridPagerInterface
* @param int $sortOrder
*/
public function setSortOrder($sortOrder);
+
+ /**
+ * @return int
+ */
+ public function getLast();
+
+ /**
+ * @return int
+ */
+ public function getNext();
+
+ /**
+ * @return int
+ */
+ public function getPrev();
+
+ /**
+ * @return int
+ */
+ public function getFirst();
+
+ /**
+ * @return DataGridActionSearch
+ */
+ public function getSourceAction();
}
\ No newline at end of file
diff --git a/inc/SP/Html/Minify.class.php b/inc/SP/Html/Minify.class.php
index 82eded62..d3ee3236 100644
--- a/inc/SP/Html/Minify.class.php
+++ b/inc/SP/Html/Minify.class.php
@@ -66,12 +66,14 @@ class Minify
/**
* @param string $base
+ * @return $this
*/
public function setBase($base)
{
$this->base = $base;
- }
+ return $this;
+ }
/**
* Devolver al navegador archivos CSS y JS comprimidos
@@ -82,6 +84,10 @@ class Minify
*/
public function getMinified($disableMinify = false)
{
+ if (count($this->files) === 0) {
+ return;
+ }
+
$offset = 3600 * 24 * 30;
$nextCheck = time() + $offset;
$expire = 'Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', $nextCheck);
@@ -96,15 +102,15 @@ class Minify
header($expire);
// Devolver código 304 si la versión es la misma y no se solicita refrescar
- if ($etag == $etagMatch && !($cacheControl == 'no-cache' || $pragma == 'no-cache')) {
- header($_SERVER["SERVER_PROTOCOL"] . " 304 Not Modified");
+ if ($etag === $etagMatch && !($cacheControl === 'no-cache' || $pragma === 'no-cache')) {
+ header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
exit;
}
if ($this->type === self::FILETYPE_JS) {
- header("Content-type: application/x-javascript; charset: UTF-8");
+ header('Content-type: application/x-javascript; charset: UTF-8');
} elseif ($this->type === self::FILETYPE_CSS) {
- header("Content-type: text/css; charset: UTF-8");
+ header('Content-type: text/css; charset: UTF-8');
}
flush();
@@ -117,20 +123,14 @@ class Minify
$filePath = $file['base'] . DIRECTORY_SEPARATOR . $file['name'];
// Obtener el recurso desde una URL
- if (preg_match('#^https?://.*#', $file['name'])) {
+ if ($file['type'] === 'url') {
try {
$data = Util::getDataFromUrl($file['name']);
echo '/* URL: ' . $file['name'] . ' */' . PHP_EOL;
echo $data;
} catch (SPException $e) {
+ error_log($e->getMessage());
}
-
- continue;
- }
-
- if (!file_exists($filePath)) {
- echo '/* ERROR: FILE NOT FOUND: ' . $file['name'] . ' */' . PHP_EOL;
- error_log('File not found: ' . $filePath);
} else {
if ($file['min'] === true && $disableMinify === false) {
@@ -144,9 +144,9 @@ class Minify
echo '/* FILE: ' . $file['name'] . ' */' . PHP_EOL;
echo file_get_contents($filePath);
}
-
- echo PHP_EOL;
}
+
+ echo PHP_EOL;
}
ob_end_flush();
@@ -162,12 +162,7 @@ class Minify
$md5Sum = '';
foreach ($this->files as $file) {
- if (preg_match('#^https?://.*#', $file['name'])) {
- continue;
- }
-
- $filePath = $file['base'] . DIRECTORY_SEPARATOR . $file['name'];
- $md5Sum .= (file_exists($filePath)) ? md5_file($filePath) : '';
+ $md5Sum .= $file['md5'];
}
return md5($md5Sum);
@@ -206,28 +201,37 @@ class Minify
}
/**
+ * Añadir un archivo
+ *
* @param string $file
* @param bool $minify Si es necesario reducir
+ * @return $this
*/
public function addFile($file, $minify = true)
{
if (strrpos($file, ',')) {
$files = explode(',', $file);
- foreach ($files as $file) {
- $this->files[] = array(
- 'base' => $this->base,
- 'name' => $file,
- 'min' => $this->needsMinify($file)
- );
+ foreach ($files as $filename) {
+ $this->addFile($filename, $minify);
}
} else {
- $this->files[] = array(
- 'base' => $this->base,
- 'name' => $file,
- 'min' => ($minify === true && $this->needsMinify($file))
- );
+ $filePath = $this->base . DIRECTORY_SEPARATOR . $file;
+
+ if (file_exists($filePath)) {
+ $this->files[] = array(
+ 'type' => 'file',
+ 'base' => $this->base,
+ 'name' => $file,
+ 'min' => $minify === true && $this->needsMinify($file),
+ 'md5' => md5_file($filePath)
+ );
+ } else {
+ error_log('File not found: ' . $filePath);
+ }
}
+
+ return $this;
}
/**
@@ -242,10 +246,34 @@ class Minify
}
/**
+ * Añadir un recurso desde URL
+ *
+ * @param $url
+ * @return $this
+ */
+ public function addUrl($url)
+ {
+ $this->files[] = array(
+ 'type' => 'url',
+ 'base' => $this->base,
+ 'name' => $url,
+ 'min' => false,
+ 'md5' => ''
+ );
+
+ return $this;
+ }
+
+ /**
+ * Establecer el tipo de recurso a procesar
+ *
* @param int $type
+ * @return $this
*/
public function setType($type)
{
- $this->type = $type;
+ $this->type = (int)$type;
+
+ return $this;
}
}
\ No newline at end of file
diff --git a/inc/SP/Http/JsonResponse.class.php b/inc/SP/Http/JsonResponse.class.php
new file mode 100644
index 00000000..645da4a5
--- /dev/null
+++ b/inc/SP/Http/JsonResponse.class.php
@@ -0,0 +1,265 @@
+.
+ */
+
+namespace SP\Http;
+
+/**
+ * Class Json para definir la estructura de una respuesta en formato JSON
+ *
+ * @package SP\Http
+ */
+class JsonResponse implements \JsonSerializable
+{
+ /**
+ * @var int
+ */
+ protected $status = 1;
+ /**
+ * @var string
+ */
+ protected $description = '';
+ /**
+ * @var string
+ */
+ protected $action = '';
+ /**
+ * @var array
+ */
+ protected $data = [];
+ /**
+ * @var array
+ */
+ protected $messages = [];
+ /**
+ * @var string
+ */
+ protected $container = '';
+ /**
+ * @var string
+ */
+ protected $csrf = '';
+
+ /**
+ * @return int
+ */
+ public function getStatus()
+ {
+ return $this->status;
+ }
+
+ /**
+ * @param int $status
+ * @return JsonResponse
+ */
+ public function setStatus($status)
+ {
+ $this->status = (int)$status;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ * @return JsonResponse
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAction()
+ {
+ return $this->action;
+ }
+
+ /**
+ * @param string $action
+ * @return JsonResponse
+ */
+ public function setAction($action)
+ {
+ $this->action = $action;
+
+ return $this;
+ }
+
+ /**
+ * @return array
+ */
+ public function getData()
+ {
+ return $this->data;
+ }
+
+ /**
+ * @param array $data
+ * @return JsonResponse
+ */
+ public function setData(array $data)
+ {
+ $this->data = $data;
+
+ return $this;
+ }
+
+ /**
+ * @return array
+ */
+ public function getMessages()
+ {
+ return $this->messages;
+ }
+
+ /**
+ * @param array $messages
+ * @return JsonResponse
+ */
+ public function setMessages(array $messages)
+ {
+ $this->messages = $messages;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getContainer()
+ {
+ return $this->container;
+ }
+
+ /**
+ * @param string $container
+ * @return JsonResponse
+ */
+ public function setContainer($container)
+ {
+ $this->container = $container;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCsrf()
+ {
+ return $this->csrf;
+ }
+
+ /**
+ * @param string $csrf
+ * @return JsonResponse
+ */
+ public function setCsrf($csrf)
+ {
+ $this->csrf = $csrf;
+
+ return $this;
+ }
+
+ /**
+ * @param $message
+ * @return JsonResponse
+ */
+ public function addMessage($message)
+ {
+ $this->messages[] = $message;
+ return $this;
+ }
+
+ /**
+ * @param $param
+ * @return $this
+ */
+ public function addParam($param)
+ {
+ if (is_numeric($param)) {
+ $param = (int)$param;
+ }
+
+ $this->data[] = $param;
+
+ return $this;
+ }
+
+ /**
+ * Specify data which should be serialized to JSON
+ * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
+ * @return mixed data which can be serialized by json_encode,
+ * which is a value of any type other than a resource.
+ * @since 5.4.0
+ */
+ public function jsonSerialize()
+ {
+ return $this->getJsonArray();
+ }
+
+ /**
+ * Devolver un array con las propiedades del objeto
+ *
+ * @return array
+ */
+ public function getJsonArray()
+ {
+ $out = [];
+
+ foreach ($this as $key => $value) {
+ $out[$key] = $value;
+ }
+
+ return $out;
+ }
+
+ /**
+ * Establecer los valores por defecto
+ *
+ * @return JsonResponse
+ */
+ public function clear()
+ {
+ $this->status = 0;
+ $this->action = '';
+ $this->data = [];
+ $this->messages = [];
+ $this->container = '';
+ $this->csrf = '';
+
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/inc/SP/Http/Request.class.php b/inc/SP/Http/Request.class.php
index 95d2c2b5..1c10399d 100644
--- a/inc/SP/Http/Request.class.php
+++ b/inc/SP/Http/Request.class.php
@@ -43,8 +43,8 @@ class Request
*/
public static function checkReferer($method)
{
- if ($_SERVER['REQUEST_METHOD'] !== strtoupper($method)
- || !isset($_SERVER['HTTP_REFERER'])
+ if (!isset($_SERVER['HTTP_REFERER'])
+ || $_SERVER['REQUEST_METHOD'] !== strtoupper($method)
|| !preg_match('#' . Init::$WEBROOT . '/.*$#', $_SERVER['HTTP_REFERER'])
) {
Init::initError(_('No es posible acceder directamente a este archivo'));
@@ -153,7 +153,7 @@ class Request
*/
public static function checkReload()
{
- return (self::getRequestHeaders('Cache-Control') == 'max-age=0');
+ return (self::getRequestHeaders('Cache-Control') === 'max-age=0');
}
/**
@@ -179,23 +179,6 @@ class Request
return $headers;
}
- /**
- * Comprobar si existen parámetros pasados por POST para enviarlos por GET
- */
- public static function importUrlParamsToGet()
- {
- foreach ($_POST as $param => $value) {
- Html::sanitize($param);
- Html::sanitize($value);
-
- if (!strncmp($param, 'g_', 2)) {
- $params[] = substr($param, 2) . '=' . $value;
- }
- }
-
- return (isset($params) && count($params) > 0) ? implode('&', $params) : '';
- }
-
/**
* Función que sustituye a apache_request_headers
*
@@ -203,11 +186,11 @@ class Request
*/
public static function getApacheHeaders()
{
- $headers = array();
+ $headers = [];
foreach ($_SERVER as $key => $value) {
- if (substr($key, 0, 5) == "HTTP_") {
- $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
+ if (strpos($key, 'HTTP_') === 0) {
+ $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
$headers[$key] = $value;
} else {
$headers[$key] = $value;
@@ -216,4 +199,23 @@ class Request
return $headers;
}
+
+ /**
+ * Comprobar si existen parámetros pasados por POST para enviarlos por GET
+ */
+ public static function importUrlParamsToGet()
+ {
+ $params = [];
+
+ foreach ($_POST as $param => $value) {
+ Html::sanitize($param);
+ Html::sanitize($value);
+
+ if (strpos($param, 'g_') !== false) {
+ $params[] = substr($param, 2) . '=' . $value;
+ }
+ }
+
+ return count($params) > 0 ? '?' . implode('&', $params) : '';
+ }
}
\ No newline at end of file
diff --git a/inc/SP/Http/Response.class.php b/inc/SP/Http/Response.class.php
index 4f2bc44d..5652d164 100644
--- a/inc/SP/Http/Response.class.php
+++ b/inc/SP/Http/Response.class.php
@@ -41,22 +41,25 @@ class Response
* @param int $status devuelve el estado
* @return bool
*/
- public static function printXML($description, $status = 1)
+ public static function printXml($description, $status = 1)
{
if (!is_string($description)) {
return false;
}
- $arrStrFrom = array("&", "<", ">", "\"", "\'");
- $arrStrTo = array("&", "<", ">", """, "'");
+ $arrStrFrom = ['&', '<', '>', '"', "\'"];
+ $arrStrTo = ['&', '<', '>', '"', '''];
$cleanDescription = str_replace($arrStrFrom, $arrStrTo, $description);
- $xml = "\n";
- $xml .= "\n" . $status . "\n " . $cleanDescription . "\n";
+ $xml[] = '';
+ $xml[] = '';
+ $xml[] = '' . $status . '';
+ $xml[] = '' . $cleanDescription . '';
+ $xml[] = '';
- header("Content-Type: application/xml");
- exit($xml);
+ header('Content-Type: application/xml');
+ exit(implode(PHP_EOL, $xml));
}
/**
@@ -67,14 +70,14 @@ class Response
* @param string $action con la accion a realizar
* @return bool
*/
- public static function printJSON($data, $status = 1, $action = '')
+ public static function printJson($data, $status = 1, $action = '')
{
if (!is_array($data)) {
- $json = array(
+ $json = [
'status' => $status,
'description' => $data,
'action' => $action
- );
+ ];
} else {
$data['status'] = $status;
$data['action'] = $action;
@@ -84,4 +87,16 @@ class Response
header('Content-type: application/json');
exit(Json::getJson($json));
}
+
+ /**
+ * Devuelve una respuesta de error en formato HTML.
+ *
+ * @param $data
+ */
+ public static function printHtmlError($data)
+ {
+ $error = '
' . htmlentities($data) . '
';
+
+ exit($error);
+ }
}
\ No newline at end of file
diff --git a/inc/SP/Log/Log.class.php b/inc/SP/Log/Log.class.php
index d2291177..baceda25 100644
--- a/inc/SP/Log/Log.class.php
+++ b/inc/SP/Log/Log.class.php
@@ -136,7 +136,7 @@ class Log extends ActionLog
if ((defined('IS_INSTALLER') && IS_INSTALLER === 1)
|| Init::$DB_STATUS === 0
) {
- error_log('Action: ' . $this->getAction() . ' -- Description: ' . $this->getDescription());
+ error_log('Action: ' . $this->getAction() . ' -- Description: ' . $this->getDescription() . ' -- Details: ' . $this->getDetails());
return false;
}
diff --git a/inc/SP/Mgmt/ItemBase.class.php b/inc/SP/Mgmt/ItemBase.class.php
index 166424f5..79f742c5 100644
--- a/inc/SP/Mgmt/ItemBase.class.php
+++ b/inc/SP/Mgmt/ItemBase.class.php
@@ -26,7 +26,7 @@
namespace SP\Mgmt;
use SP\Core\Exceptions\InvalidClassException;
-use SP\Core\SingleFactory;
+use SP\Core\DiFactory;
/**
* Class ItemBase
@@ -67,7 +67,7 @@ abstract class ItemBase
*/
public final static function getItem($itemData = null)
{
- return SingleFactory::getItem(get_called_class(), $itemData);
+ return DiFactory::getItem(get_called_class(), $itemData);
}
/**
diff --git a/inc/SP/Mgmt/Users/UserUtil.class.php b/inc/SP/Mgmt/Users/UserUtil.class.php
index d69d8e32..dbf61ec4 100644
--- a/inc/SP/Mgmt/Users/UserUtil.class.php
+++ b/inc/SP/Mgmt/Users/UserUtil.class.php
@@ -140,7 +140,7 @@ class UserUtil
'SELECT user_id, user_login, user_name FROM usrData ORDER BY user_login';
$Data = new QueryData();
- $Data->setMapClassName('\SP\DataModel\UserData');
+// $Data->setMapClassName('\SP\DataModel\UserData');
$Data->setQuery($query);
DB::setReturnArray();
diff --git a/inc/SP/Storage/DB.class.php b/inc/SP/Storage/DB.class.php
index 8b027d46..9d8102b0 100644
--- a/inc/SP/Storage/DB.class.php
+++ b/inc/SP/Storage/DB.class.php
@@ -26,7 +26,7 @@
namespace SP\Storage;
use PDO;
-use SP\Core\SingleFactory;
+use SP\Core\DiFactory;
use SP\Log\Log;
use SP\Core\Exceptions\SPException;
use SP\Util\Util;
@@ -208,7 +208,7 @@ class DB
}
try {
- $db = SingleFactory::getDBStorage()->getConnection();
+ $db = DiFactory::getDBStorage()->getConnection();
if (is_array($queryData->getParams())) {
$sth = $db->prepare($queryData->getQuery());
@@ -285,7 +285,7 @@ class DB
$queryData->setQuery($query);
try {
- $db = SingleFactory::getDBStorage()->getConnection();
+ $db = DiFactory::getDBStorage()->getConnection();
$queryRes = (is_array($queryData->getParams())) ? $this->prepareQueryData($queryData, true) : $db->query($query);
$num = intval($queryRes->fetchColumn());
$queryRes->closeCursor();
@@ -315,8 +315,8 @@ class DB
$Log->addDetails('SQL', DBUtil::escape($query));
$Log->writeLog();
- error_log($query);
- error_log($errorMsg);
+ error_log($Log->getDescription());
+ error_log($Log->getDetails());
}
/**
diff --git a/inc/SP/Storage/DBUtil.class.php b/inc/SP/Storage/DBUtil.class.php
index a29e6806..d829131d 100644
--- a/inc/SP/Storage/DBUtil.class.php
+++ b/inc/SP/Storage/DBUtil.class.php
@@ -27,7 +27,7 @@ namespace SP\Storage;
use SP\Config\Config;
-use SP\Core\SingleFactory;
+use SP\Core\DiFactory;
use SP\Core\Exceptions\SPException;
/**
@@ -46,7 +46,7 @@ class DBUtil
public static function checkDatabaseExist()
{
try {
- $db = SingleFactory::getDBStorage()->getConnection();
+ $db = DiFactory::getDBStorage()->getConnection();
$query = /** @lang SQL */
'SELECT COUNT(*)
@@ -115,7 +115,7 @@ class DBUtil
public static function escape($str)
{
try {
- $db = SingleFactory::getDBStorage()->getConnection();
+ $db = DiFactory::getDBStorage()->getConnection();
return $db->quote(trim($str));
} catch (SPException $e) {
@@ -133,7 +133,7 @@ class DBUtil
$dbinfo = array();
try {
- $db = SingleFactory::getDBStorage()->getConnection();
+ $db = DiFactory::getDBStorage()->getConnection();
$attributes = array(
'SERVER_VERSION',
diff --git a/inc/SP/Storage/MySQLHandler.class.php b/inc/SP/Storage/MySQLHandler.class.php
index af81360b..8955b1f8 100644
--- a/inc/SP/Storage/MySQLHandler.class.php
+++ b/inc/SP/Storage/MySQLHandler.class.php
@@ -120,8 +120,6 @@ class MySQLHandler implements DBStorageInterface
$isInstalled = Config::getConfig()->isInstalled();
if (empty($this->dbHost) || empty($this->dbUser) || empty($this->dbPass) || empty($this->dbName)) {
- Init::$DB_STATUS = 0;
-
if ($isInstalled) {
Init::initError(_('No es posible conectar con la BD'), _('Compruebe los datos de conexión'));
} else {
@@ -135,8 +133,9 @@ class MySQLHandler implements DBStorageInterface
$dsn = 'mysql:host=' . $this->dbHost . ';port=' . $this->dbPort . ';dbname=' . $this->dbName . ';charset=utf8';
// $this->db = new PDO($dsn, $dbuser, $dbpass, array(PDO::ATTR_PERSISTENT => true));
$this->db = new PDO($dsn, $this->dbUser, $this->dbPass);
+
+ Init::$DB_STATUS = 1;
} catch (\Exception $e) {
- Init::$DB_STATUS = 0;
if ($isInstalled) {
if ($e->getCode() === 1049) {
diff --git a/inc/SP/Util/Json.class.php b/inc/SP/Util/Json.class.php
index 686f5755..8aed0c3a 100644
--- a/inc/SP/Util/Json.class.php
+++ b/inc/SP/Util/Json.class.php
@@ -24,7 +24,9 @@
*/
namespace SP\Util;
+
use SP\Core\Exceptions\SPException;
+use SP\Http\JsonResponse;
/**
@@ -34,6 +36,18 @@ use SP\Core\Exceptions\SPException;
*/
class Json
{
+ /**
+ * Devuelve una respuesta en formato JSON con el estado y el mensaje.
+ *
+ * @param JsonResponse $json
+ * @return bool
+ */
+ public static function returnJson(JsonResponse $json)
+ {
+ header('Content-type: application/json');
+ exit(self::getJson($json));
+ }
+
/**
* Devuelve una cadena en formato JSON
*
diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php
index 6c25c28e..eaecdc59 100644
--- a/inc/SP/Util/Util.class.php
+++ b/inc/SP/Util/Util.class.php
@@ -200,7 +200,7 @@ class Util
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- if (!is_null($data)) {
+ if (null !== $data) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $data['type']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data['data']);
@@ -325,7 +325,7 @@ class Util
*/
public static function logout()
{
- exit('');
+ exit('');
}
/**
diff --git a/inc/sql/1.3.16011001.sql b/inc/sql/1.3.16011001.sql
new file mode 100644
index 00000000..391880eb
--- /dev/null
+++ b/inc/sql/1.3.16011001.sql
@@ -0,0 +1,42 @@
+-- To 1.3.16011001
+CREATE TABLE `publicLinks` (
+ publicLink_id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+ publicLink_itemId INT,
+ publicLink_hash VARBINARY(100) NOT NULL,
+ publicLink_linkData LONGBLOB
+);
+ALTER TABLE `usrData` ENGINE = InnoDB ;
+ALTER TABLE `accFiles` ENGINE = InnoDB ;
+ALTER TABLE `accGroups` ENGINE = InnoDB ;
+ALTER TABLE `accHistory` ENGINE = InnoDB ;
+ALTER TABLE `accUsers` ENGINE = InnoDB ;
+ALTER TABLE `categories` ENGINE = InnoDB ;
+ALTER TABLE `config` ENGINE = InnoDB ;
+ALTER TABLE `customers` ENGINE = InnoDB ;
+ALTER TABLE `log` ENGINE = InnoDB;
+ALTER TABLE `usrGroups` ENGINE = InnoDB ;
+ALTER TABLE `usrPassRecover` ENGINE = InnoDB ;
+ALTER TABLE `usrProfiles` ENGINE = InnoDB ;
+ALTER TABLE `accounts`
+ENGINE = InnoDB ,
+DROP INDEX `IDX_searchTxt` ,
+ADD INDEX `IDX_searchTxt` (`account_name` ASC, `account_login` ASC, `account_url` ASC);
+CREATE UNIQUE INDEX unique_publicLink_accountId ON publicLinks (publicLink_itemId);
+CREATE UNIQUE INDEX unique_publicLink_hash ON publicLinks (publicLink_hash);
+ALTER TABLE `log` ADD log_level VARCHAR(20) NOT NULL;
+ALTER TABLE `config` CHANGE config_value config_value VARCHAR(2000);
+CREATE TABLE `accFavorites` (
+ `accfavorite_accountId` SMALLINT UNSIGNED NOT NULL,
+ `accfavorite_userId` SMALLINT UNSIGNED NOT NULL,
+ INDEX `fk_accFavorites_accounts_idx` (`accfavorite_accountId` ASC),
+ INDEX `fk_accFavorites_users_idx` (`accfavorite_userId` ASC),
+ INDEX `search_idx` (`accfavorite_accountId` ASC, `accfavorite_userId` ASC),
+ CONSTRAINT `fk_accFavorites_accounts` FOREIGN KEY (`accfavorite_accountId`) REFERENCES `accounts` (`account_id`)
+ ON DELETE CASCADE
+ ON UPDATE NO ACTION,
+ CONSTRAINT `fk_accFavorites_users` FOREIGN KEY (`accfavorite_userId`) REFERENCES `usrData` (`user_id`)
+ ON DELETE CASCADE
+ ON UPDATE NO ACTION
+)
+ ENGINE = InnoDB
+ DEFAULT CHARSET = utf8;
\ No newline at end of file
diff --git a/inc/sql/1.3.16100601.sql b/inc/sql/1.3.16100601.sql
new file mode 100644
index 00000000..d4c15fdd
--- /dev/null
+++ b/inc/sql/1.3.16100601.sql
@@ -0,0 +1,220 @@
+-- To 1.3.16100601
+ALTER TABLE `syspass-dev`.`accHistory`
+CHANGE COLUMN `acchistory_userId` `acchistory_userId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `acchistory_userEditId` `acchistory_userEditId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `acchistory_customerId` `acchistory_customerId` INT(10) UNSIGNED NOT NULL ,
+CHANGE COLUMN `acchistory_categoryId` `acchistory_categoryId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `acchistory_dateEdit` `acchistory_dateEdit` DATETIME NULL DEFAULT NULL ,
+ADD INDEX `fk_accHistory_users_id_idx` (`acchistory_userId` ASC, `acchistory_userEditId` ASC),
+ADD INDEX `fk_accHistory_categories_id_idx` (`acchistory_categoryId` ASC),
+ADD INDEX `fk_accHistory_customers_id_idx` (`acchistory_customerId` ASC);
+
+ALTER TABLE `syspass-dev`.`accTags`
+CHANGE COLUMN `acctag_accountId` `acctag_accountId` SMALLINT(10) UNSIGNED NOT NULL ,
+DROP INDEX `IDX_id` ,
+ADD INDEX `IDX_id` (`acctag_accountId` ASC),
+ADD INDEX `fk_accTags_tags_id_idx` (`acctag_tagId` ASC);
+
+ALTER TABLE `syspass-dev`.`accUsers`
+DROP COLUMN `accuser_id`,
+CHANGE COLUMN `accuser_accountId` `accuser_accountId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `accuser_userId` `accuser_userId` SMALLINT(5) UNSIGNED NOT NULL ,
+ADD INDEX `fk_accUsers_users_id_idx` (`accuser_userId` ASC),
+DROP PRIMARY KEY;
+
+ALTER TABLE `syspass-dev`.`accViewLinks`
+CHANGE COLUMN `accviewlinks_accountId` `accviewlinks_accountId` SMALLINT(5) UNSIGNED NULL DEFAULT NULL ,
+CHANGE COLUMN `accviewlinks_userId` `accviewlinks_userId` SMALLINT(5) UNSIGNED NULL DEFAULT NULL ,
+ADD INDEX `fk_accViewLinks_account_idx` (`accviewlinks_accountId` ASC),
+ADD INDEX `fk_accViewLinks_user_id_idx` (`accviewlinks_userId` ASC);
+
+ALTER TABLE `syspass-dev`.`accounts`
+CHANGE COLUMN `account_id` `account_id` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `account_userId` `account_userId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `account_userEditId` `account_userEditId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `account_categoryId` `account_categoryId` SMALLINT(3) UNSIGNED NOT NULL ,
+CHANGE COLUMN `account_dateEdit` `account_dateEdit` DATETIME NULL DEFAULT NULL ,
+ADD INDEX `fk_accounts_user_id_idx` (`account_userId` ASC, `account_userEditId` ASC);
+
+ALTER TABLE `syspass-dev`.`authTokens`
+CHANGE COLUMN `authtoken_userId` `authtoken_userId` SMALLINT(5) UNSIGNED NOT NULL ,
+ADD INDEX `fk_authTokens_users_id_idx` (`authtoken_userId` ASC, `authtoken_createdBy` ASC);
+
+ALTER TABLE `syspass-dev`.`log`
+CHANGE COLUMN `log_userId` `log_userId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `log_description` `log_description` TEXT NULL DEFAULT NULL ,
+ADD INDEX `fk_log_users_id_idx` (`log_userId` ASC);
+
+ALTER TABLE `syspass-dev`.`usrData`
+CHANGE COLUMN `user_groupId` `user_groupId` SMALLINT(3) UNSIGNED NOT NULL ,
+CHANGE COLUMN `user_secGroupId` `user_secGroupId` SMALLINT(3) UNSIGNED NULL DEFAULT NULL ,
+CHANGE COLUMN `user_profileId` `user_profileId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `user_isAdminApp` `user_isAdminApp` BIT(1) NULL DEFAULT b'0' ,
+CHANGE COLUMN `user_isAdminAcc` `user_isAdminAcc` BIT(1) NULL DEFAULT b'0' ,
+CHANGE COLUMN `user_isLdap` `user_isLdap` BIT(1) NULL DEFAULT b'0' ,
+CHANGE COLUMN `user_isDisabled` `user_isDisabled` BIT(1) NULL DEFAULT b'0' ,
+ADD INDEX `fk_usrData_groups_id_idx` (`user_groupId` ASC),
+ADD INDEX `fk_usrData_profiles_id_idx` (`user_profileId` ASC);
+
+ALTER TABLE `syspass-dev`.`usrPassRecover`
+CHANGE COLUMN `userpassr_used` `userpassr_used` BIT(1) NULL DEFAULT b'0' ;
+
+ALTER TABLE `syspass-dev`.`usrToGroups`
+DROP COLUMN `usertogroup_id`,
+CHANGE COLUMN `usertogroup_userId` `usertogroup_userId` SMALLINT(5) UNSIGNED NOT NULL ,
+CHANGE COLUMN `usertogroup_groupId` `usertogroup_groupId` SMALLINT(5) UNSIGNED NOT NULL ,
+ADD INDEX `fk_usrToGroups_groups_id_idx` (`usertogroup_groupId` ASC),
+DROP PRIMARY KEY;
+
+ALTER TABLE `syspass-dev`.`accFavorites`
+ADD CONSTRAINT `fk_accFavorites_accounts_id`
+ FOREIGN KEY (`accfavorite_accountId`)
+ REFERENCES `syspass-dev`.`accounts` (`account_id`)
+ ON DELETE CASCADE
+ ON UPDATE NO ACTION,
+ADD CONSTRAINT `fk_accFavorites_users_id`
+ FOREIGN KEY (`accfavorite_userId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id`)
+ ON DELETE CASCADE
+ ON UPDATE NO ACTION;
+
+ALTER TABLE `syspass-dev`.`accFiles`
+ADD CONSTRAINT `fk_accFiles_accounts_id`
+ FOREIGN KEY (`accfile_accountId`)
+ REFERENCES `syspass-dev`.`accounts` (`account_id`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION;
+
+ALTER TABLE `syspass-dev`.`accGroups`
+ADD CONSTRAINT `fk_accGroups_accounts_id`
+ FOREIGN KEY (`accgroup_accountId`)
+ REFERENCES `syspass-dev`.`accounts` (`account_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ADD CONSTRAINT `fk_accGroups_groups_id`
+ FOREIGN KEY (`accgroup_groupId`)
+ REFERENCES `syspass-dev`.`usrGroups` (`usergroup_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
+
+ALTER TABLE `syspass-dev`.`accHistory`
+ADD CONSTRAINT `fk_accHistory_users_id`
+ FOREIGN KEY (`acchistory_userId` , `acchistory_userEditId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id` , `user_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT,
+ADD CONSTRAINT `fk_accHistory_categories_id`
+ FOREIGN KEY (`acchistory_categoryId`)
+ REFERENCES `syspass-dev`.`categories` (`category_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT,
+ADD CONSTRAINT `fk_accHistory_customers_id`
+ FOREIGN KEY (`acchistory_customerId`)
+ REFERENCES `syspass-dev`.`customers` (`customer_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT;
+
+ALTER TABLE `syspass-dev`.`accTags`
+ADD CONSTRAINT `fk_accTags_accounts_id`
+ FOREIGN KEY (`acctag_accountId`)
+ REFERENCES `syspass-dev`.`accounts` (`account_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ADD CONSTRAINT `fk_accTags_tags_id`
+ FOREIGN KEY (`acctag_tagId`)
+ REFERENCES `syspass-dev`.`tags` (`tag_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
+
+ALTER TABLE `syspass-dev`.`accUsers`
+ADD CONSTRAINT `fk_accUsers_accounts_id`
+ FOREIGN KEY (`accuser_accountId`)
+ REFERENCES `syspass-dev`.`accounts` (`account_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ADD CONSTRAINT `fk_accUsers_users_id`
+ FOREIGN KEY (`accuser_userId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
+
+ALTER TABLE `syspass-dev`.`accViewLinks`
+ADD CONSTRAINT `fk_accViewLinks_account_id`
+ FOREIGN KEY (`accviewlinks_accountId`)
+ REFERENCES `syspass-dev`.`accounts` (`account_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ADD CONSTRAINT `fk_accViewLinks_user_id`
+ FOREIGN KEY (`accviewlinks_userId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION;
+
+ALTER TABLE `syspass-dev`.`accounts`
+ADD CONSTRAINT `fk_accounts_categories_id`
+ FOREIGN KEY (`account_categoryId`)
+ REFERENCES `syspass-dev`.`categories` (`category_id`)
+ ON DELETE RESTRICT
+ ON UPDATE CASCADE,
+ADD CONSTRAINT `fk_accounts_user_id`
+ FOREIGN KEY (`account_userId` , `account_userEditId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id` , `user_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT,
+ADD CONSTRAINT `fk_accounts_customer_id`
+ FOREIGN KEY (`account_customerId`)
+ REFERENCES `syspass-dev`.`customers` (`customer_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT;
+
+ALTER TABLE `syspass-dev`.`authTokens`
+ADD CONSTRAINT `fk_authTokens_users_id`
+ FOREIGN KEY (`authtoken_userId` , `authtoken_createdBy`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id` , `user_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
+
+ALTER TABLE `syspass-dev`.`customFieldsData`
+ADD CONSTRAINT `fk_customFieldsData_def_id`
+ FOREIGN KEY (`customfielddata_defId`)
+ REFERENCES `syspass-dev`.`customFieldsDef` (`customfielddef_id`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION;
+
+ALTER TABLE `syspass-dev`.`log`
+ADD CONSTRAINT `fk_log_users_id`
+ FOREIGN KEY (`log_userId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT;
+
+ALTER TABLE `syspass-dev`.`usrData`
+ADD CONSTRAINT `fk_usrData_groups_id`
+ FOREIGN KEY (`user_groupId`)
+ REFERENCES `syspass-dev`.`usrGroups` (`usergroup_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT,
+ADD CONSTRAINT `fk_usrData_profiles_id`
+ FOREIGN KEY (`user_profileId`)
+ REFERENCES `syspass-dev`.`usrProfiles` (`userprofile_id`)
+ ON DELETE RESTRICT
+ ON UPDATE RESTRICT;
+
+ALTER TABLE `syspass-dev`.`usrPassRecover`
+ADD CONSTRAINT `fk_usrPassRecover_users`
+ FOREIGN KEY (`userpassr_userId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
+
+ALTER TABLE `syspass-dev`.`usrToGroups`
+ADD CONSTRAINT `fk_usrToGroups_users_id`
+ FOREIGN KEY (`usertogroup_userId`)
+ REFERENCES `syspass-dev`.`usrData` (`user_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ADD CONSTRAINT `fk_usrToGroups_groups_id`
+ FOREIGN KEY (`usertogroup_groupId`)
+ REFERENCES `syspass-dev`.`usrGroups` (`usergroup_id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
\ No newline at end of file
diff --git a/inc/dbstructure.sql b/inc/sql/dbstructure.sql
similarity index 100%
rename from inc/dbstructure.sql
rename to inc/sql/dbstructure.sql
diff --git a/sql/upgrade.sql b/inc/sql/upgrade.sql
similarity index 77%
rename from sql/upgrade.sql
rename to inc/sql/upgrade.sql
index c733d05b..708ebd61 100644
--- a/sql/upgrade.sql
+++ b/inc/sql/upgrade.sql
@@ -105,46 +105,4 @@ CREATE TABLE `customFieldsData` (
ALTER TABLE `config` CHANGE config_value config_value VARCHAR(255);
ALTER TABLE `usrData` CHANGE user_pass user_pass VARBINARY(255);
ALTER TABLE `usrData` CHANGE user_hashSalt user_hashSalt VARBINARY(128);
-ALTER TABLE `accHistory` CHANGE acchistory_mPassHash acchistory_mPassHash VARBINARY(255);
--- To 1.3.16011001
-CREATE TABLE `publicLinks` (
- publicLink_id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
- publicLink_itemId INT,
- publicLink_hash VARBINARY(100) NOT NULL,
- publicLink_linkData LONGBLOB
-);
-ALTER TABLE `usrData` ENGINE = InnoDB ;
-ALTER TABLE `accFiles` ENGINE = InnoDB ;
-ALTER TABLE `accGroups` ENGINE = InnoDB ;
-ALTER TABLE `accHistory` ENGINE = InnoDB ;
-ALTER TABLE `accUsers` ENGINE = InnoDB ;
-ALTER TABLE `categories` ENGINE = InnoDB ;
-ALTER TABLE `config` ENGINE = InnoDB ;
-ALTER TABLE `customers` ENGINE = InnoDB ;
-ALTER TABLE `log` ENGINE = InnoDB;
-ALTER TABLE `usrGroups` ENGINE = InnoDB ;
-ALTER TABLE `usrPassRecover` ENGINE = InnoDB ;
-ALTER TABLE `usrProfiles` ENGINE = InnoDB ;
-ALTER TABLE `accounts`
-ENGINE = InnoDB ,
-DROP INDEX `IDX_searchTxt` ,
-ADD INDEX `IDX_searchTxt` (`account_name` ASC, `account_login` ASC, `account_url` ASC);
-CREATE UNIQUE INDEX unique_publicLink_accountId ON publicLinks (publicLink_itemId);
-CREATE UNIQUE INDEX unique_publicLink_hash ON publicLinks (publicLink_hash);
-ALTER TABLE `log` ADD log_level VARCHAR(20) NOT NULL;
-ALTER TABLE `config` CHANGE config_value config_value VARCHAR(2000);
-CREATE TABLE `accFavorites` (
- `accfavorite_accountId` SMALLINT UNSIGNED NOT NULL,
- `accfavorite_userId` SMALLINT UNSIGNED NOT NULL,
- INDEX `fk_accFavorites_accounts_idx` (`accfavorite_accountId` ASC),
- INDEX `fk_accFavorites_users_idx` (`accfavorite_userId` ASC),
- INDEX `search_idx` (`accfavorite_accountId` ASC, `accfavorite_userId` ASC),
- CONSTRAINT `fk_accFavorites_accounts` FOREIGN KEY (`accfavorite_accountId`) REFERENCES `accounts` (`account_id`)
- ON DELETE CASCADE
- ON UPDATE NO ACTION,
- CONSTRAINT `fk_accFavorites_users` FOREIGN KEY (`accfavorite_userId`) REFERENCES `usrData` (`user_id`)
- ON DELETE CASCADE
- ON UPDATE NO ACTION
-)
- ENGINE = InnoDB
- DEFAULT CHARSET = utf8;
\ No newline at end of file
+ALTER TABLE `accHistory` CHANGE acchistory_mPassHash acchistory_mPassHash VARBINARY(255);
\ No newline at end of file
diff --git a/inc/themes/classic/inc/Icons.class.php b/inc/themes/classic/inc/Icons.class.php
index edd9bdf0..7a2ced6f 100644
--- a/inc/themes/classic/inc/Icons.class.php
+++ b/inc/themes/classic/inc/Icons.class.php
@@ -28,7 +28,7 @@ namespace Theme;
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
use SP\Core\Init;
-use SP\Core\ThemeIconsBase;
+use SP\Core\UI\ThemeIconsBase;
use SP\Html\Assets\FontIcon;
use SP\Html\Assets\ImageIcon;
diff --git a/inc/themes/classic/sessionbar.inc b/inc/themes/classic/sessionbar.inc
index 331f5764..abd02448 100644
--- a/inc/themes/classic/sessionbar.inc
+++ b/inc/themes/classic/sessionbar.inc
@@ -2,12 +2,14 @@