diff --git a/ajax/ajax_configSave.php b/ajax/ajax_configSave.php index af049b90..8538fda1 100644 --- a/ajax/ajax_configSave.php +++ b/ajax/ajax_configSave.php @@ -59,6 +59,7 @@ if ($frmAction == "config") { $frmAccountCount = SP_Common::parseParams('p', 'account_count', 10); $frmAllowedSize = SP_Common::parseParams('p', 'files_allowed_size', 1024); $frmAllowedExts = SP_Common::parseParams('p', 'files_allowed_exts'); + $frmResultsAsCards = SP_Common::parseParams('p', 'resultsascards', false, false, true); $frmWiki = SP_Common::parseParams('p', 'wiki_enabled', false, false, true); $frmWikiSearchUrl = SP_Common::parseParams('p', 'wiki_searchurl'); @@ -147,6 +148,7 @@ if ($frmAction == "config") { SP_Config::setValue("maintenance", $frmMaintenance); SP_Config::setValue("checkupdates", $frmCheckUpdates); SP_Config::setValue("files_enabled", $frmFiles); + SP_Config::setValue("resultsascards", $frmResultsAsCards); SP_Config::setValue("globalsearch", $frmGlobalSearch); SP_Config::setValue("files_allowed_size", $frmAllowedSize); @@ -155,6 +157,9 @@ if ($frmAction == "config") { SP_Log::wrLogInfo($message); SP_Common::sendEmail($message); + // Recargar la aplicación completa para establecer nuevos valores + SP_Util::reload(); + SP_Common::printJSON(_('Configuración actualizada'), 0, $doActionOnClose); } elseif ($frmAction == "crypt") { $currentMasterPass = SP_Common::parseParams('p', 'curMasterPwd', '', false, false, false); diff --git a/ajax/ajax_getContent.php b/ajax/ajax_getContent.php index fbf972de..f8a53d6b 100644 --- a/ajax/ajax_getContent.php +++ b/ajax/ajax_getContent.php @@ -32,6 +32,8 @@ if (!SP_Init::isLoggedIn()) { SP_Util::logout(); } +SP_Util::checkReload(); + if (SP_Common::parseParams('p', 'action', '', true)) { $action = $tplvars['action'] = SP_Common::parseParams('p', 'action'); $itemId = $tplvars['id'] = SP_Common::parseParams('p', 'id', 0); diff --git a/ajax/ajax_search.php b/ajax/ajax_search.php index 3f5ff640..2948ec19 100644 --- a/ajax/ajax_search.php +++ b/ajax/ajax_search.php @@ -51,6 +51,7 @@ if ($wikiEnabled) { $wikiPageUrl = SP_Config::getValue('wiki_pageurl'); } $requestEnabled = SP_Util::mailrequestIsEnabled(); +$maxTextLength = (SP_Util::resultsCardsIsEnabled()) ? 30 : 60; // Valores POST $sortKey = SP_Common::parseParams('p', 'skey', 0); @@ -68,6 +69,26 @@ $userId = SP_Common::parseParams('s', 'uid', 0); $filterOn = ($sortKey > 1 || $customerId || $categoryId || $searchTxt) ? true : false; +$colors = array( + 'FF66CC', + 'FF99FF', + 'CC99FF', + '9999FF', + '6699FF', + '3399FF', + '0099FF', + '6699FF', + '3399FF', + '00CC66', + '00CC66', + '00CC99', + '00CCCC', + 'FFCC66', + 'FF9999', + 'FF6699', + 'FF99CC' +); + $objAccount = new SP_Account; $arrSearchFilter = array("txtSearch" => $searchTxt, "userId" => $userId, @@ -133,23 +154,24 @@ foreach ($resQuery as $account) { $show = ($accView || $accViewPass || $accEdit || $accCopy || $accDel); - $randomRGB = array(rand(150, 210), rand(150, 210), rand(150, 210)); - $color = array($account->account_customerId => array(SP_Html::rgb2hex($randomRGB), $randomRGB)); + //$randomRGB = array(rand(150, 210), rand(150, 210), rand(150, 210)); + //$color = array($account->account_customerId => array(SP_Html::rgb2hex($randomRGB), $randomRGB)); + $color = array_rand($colors); if (!isset($customerColor)) { - $customerColor = $color; + $customerColor[$account->account_customerId] = '#'.$colors[$color]; } elseif (isset($customerColor) && !array_key_exists($account->account_customerId, $customerColor)) { - $customerColor = $color; + $customerColor[$account->account_customerId] = '#'.$colors[$color]; } - $hexColor = $customerColor[$account->account_customerId][0]; - //$rgbaColor = implode(',',$customerColor[$account->account_customerId][1]).',0.1'; + //$hexColor = $customerColor[$account->account_customerId][0]; + $hexColor = $customerColor[$account->account_customerId]; if ($wikiEnabled) { $wikiLink = $wikiSearchUrl . $account->customer_name; - $customerName = '' . SP_Html::truncate($account->customer_name, 31) . ''; + $customerName = '' . SP_Html::truncate($account->customer_name, $maxTextLength) . ''; } else { - $customerName = SP_Html::truncate($account->customer_name, 31); + $customerName = SP_Html::truncate($account->customer_name, $maxTextLength); } if ($accountLink && $show) { @@ -163,14 +185,15 @@ foreach ($resQuery as $account) { $accountName = $account->account_name; } + // Obtenemos datos si el usuario tiene acceso a los datos de la cuenta if ($show) { - $vacLogin = (strlen($account->account_login) >= 31) ? SP_Html::truncate($account->account_login, 31) : $account->account_login; + $vacLogin = (strlen($account->account_login) >= $maxTextLength) ? SP_Html::truncate($account->account_login, $maxTextLength) : $account->account_login; $strAccUrl = $account->account_url; $urlIsLink = ($strAccUrl && preg_match("#^https?://.*#i", $strAccUrl)); - if (strlen($strAccUrl) >= 31) { - $strAccUrl_short = SP_Html::truncate($strAccUrl, 31); + if (strlen($strAccUrl) >= $maxTextLength) { + $strAccUrl_short = SP_Html::truncate($strAccUrl, $maxTextLength); $strAccUrl = ($urlIsLink) ? '' . $strAccUrl_short . '' : $strAccUrl_short; } else { @@ -200,28 +223,29 @@ foreach ($resQuery as $account) { //echo '
';
- echo '
';
+ echo '
';
}
- if ($accEdit || $accCopy || $accDel) {
+ if ($accEdit || $accCopy || $accDel || $accViewPass) {
echo '
';
}
@@ -308,16 +332,15 @@ SP_Html::printQuerySearchNavBar($sortKey, $arrSearchFilter["limitStart"], $objAc
var client = new ZeroClipboard( $('.clip_pass_button'), {
moviePath: "js/ZeroClipboard.swf",
- debug: true
- } );
+ debug: false
+ });
//client.setText(data);
client.on( 'load', function(client) {
$('#global-zeroclipboard-html-bridge').attr('rel', 'tooltip').attr('title', '');
- } );
+ });
client.on( "complete", function(client, args) {
resMsg("ok", "");
- //console.log("Copied text to clipboard: " + args.text );
- } );
+ });
\ No newline at end of file
diff --git a/ajax/ajax_viewpass.php b/ajax/ajax_viewpass.php
index ceb9d05e..3f1ba737 100644
--- a/ajax/ajax_viewpass.php
+++ b/ajax/ajax_viewpass.php
@@ -29,7 +29,7 @@ require_once APP_ROOT.DIRECTORY_SEPARATOR.'inc'.DIRECTORY_SEPARATOR.'init.php';
SP_Util::checkReferer('POST');
if (!SP_Init::isLoggedIn()) {
- return;
+ return -1;
}
$accountId = SP_Common::parseParams('p', 'accountid', false);
@@ -75,18 +75,16 @@ $crypt = new SP_Crypt;
$masterPass = $crypt->getSessionMasterPass();
$accountClearPass = $crypt->decrypt($accountData->account_pass, $masterPass, $accountData->account_IV);
-
-if (!$isHistory) {
+if (!$isHistory && $fullTxt) {
$account->incrementDecryptCounter();
+
+ $message['action'] = _('Ver Clave');
+ $message['text'][] = _('ID') . ': ' . $accountId;
+ $message['text'][] = _('Cuenta') . ': ' . $accountData->customer_name . " / " . $accountData->account_name;
+
+ SP_Log::wrLogInfo($message);
}
-$message['action'] = _('Ver Clave');
-$message['text'][] = _('ID') . ': ' . $accountId;
-$message['text'][] = _('Cuenta') . ': ' . $accountData->customer_name . " / " . $accountData->account_name;
-$message['text'][] = _('IP') . ': ' . $_SERVER['REMOTE_ADDR'];
-
-SP_Log::wrLogInfo($message);
-
if ($fullTxt) {
?>
';
diff --git a/inc/html.class.php b/inc/html.class.php
index 70a1733f..9a70c0c2 100644
--- a/inc/html.class.php
+++ b/inc/html.class.php
@@ -183,6 +183,10 @@ class SP_Html
array("href" => "js/fancybox/jquery.fancybox.css", "media" => "screen"),
array("href" => "css/styles.css", "media" => ""));
+ if ( ! SP_Util::resultsCardsIsEnabled() ){
+ array_push($cssProp,array("href" => "css/search-grid.css", "media" => ""));
+ }
+
foreach ($cssProp as $css) {
self::$htmlPage[] = '';
}
@@ -261,14 +265,14 @@ class SP_Html
{
$info = self::getAppInfo();
- self::$htmlPage[] = ' ';
+ self::$htmlPage[] = ' ';
self::$htmlPage[] = '';
}
diff --git a/inc/tpl/config.php b/inc/tpl/config.php
index 5a61e588..93172872 100644
--- a/inc/tpl/config.php
+++ b/inc/tpl/config.php
@@ -54,6 +54,7 @@ $chkLdap = ( SP_Config::getValue('ldap_enabled') ) ? 'checked="checked"' : '';
$chkMail = ( SP_Config::getValue('mail_enabled') ) ? 'checked="checked"' : '';
$chkMailRequests = ( SP_Config::getValue('mail_requestsenabled') ) ? 'checked="checked"' : '';
$chkMailAuth = ( SP_Config::getValue('mail_authenabled') ) ? 'checked="checked"' : '';
+$chkResultsAsCards = ( SP_Config::getValue('resultsascards') ) ? 'checked="checked"' : '';
$allowedExts = SP_Config::getValue('files_allowed_exts');
?>
@@ -190,6 +191,16 @@ $allowedExts = SP_Config::getValue('files_allowed_exts');
+
');
- } else {
- $('#search-sort-' + skey).append('
');
+ $('#resBuscar').css("max-height", $('html').height() - windowAdjustSize);
+
+ if ( order.key ){
+ $('#search-sort-' + order.key).addClass('filterOn');
+ if (order.dir == 0) {
+ $('#search-sort-' + order.key).append('
');
+ } else {
+ $('#search-sort-' + order.key).append('
');
+ }
}
},
error: function () {
@@ -201,7 +205,7 @@ function searchSort(skey, start, nav) {
});
}
-// Función para buscar con la ordenación por campos
+// Función para navegar por el log de eventos
function navLog(start, current) {
if (typeof(start) === "undefined") return false;
@@ -239,7 +243,7 @@ function viewPass(id, full, history) {
async: false,
data: {'accountid': id, 'full': full, 'isHistory': history},
success: function(data){
- if (data.length === 0) {
+ if (data === "-1") {
doLogout();
} else {
if ( full === 0 ){
@@ -254,7 +258,7 @@ function viewPass(id, full, history) {
});
}
-// Función para las variables de la URL y parsearlas a un array.
+// Función para obtener las variables de la URL y parsearlas a un array.
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
@@ -311,6 +315,7 @@ function doLogin() {
return false;
}
+// Función para salir de la sesión
function doLogout() {
var url = window.location.search;
@@ -321,6 +326,7 @@ function doLogout() {
}
}
+// Función para comprobar si se ha salido de la sesión
function checkLogout() {
var session = getUrlVars()["session"];
@@ -498,6 +504,7 @@ function delFile(id, sk, accid) {
});
}
+// Función para activar el Drag&Drop de archivos en las cuentas
function dropFile(accountId, sk, maxsize) {
var dropfiles = $('#dropzone');
var file_exts_ok = dropfiles.attr('data-files-ext').toLowerCase().split(',');
@@ -547,6 +554,7 @@ function dropFile(accountId, sk, maxsize) {
});
}
+// Función para activar el Drag&Drop de archivos en la importación de cuentas
function importFile(sk) {
var dropfiles = $('#dropzone');
var file_exts_ok = ['csv'];
@@ -602,7 +610,7 @@ function importFile(sk) {
});
}
-// Función para realizar la petición ajax
+// Función para realizar una petición ajax
function sendAjax(data, url) {
$.fancybox.showLoading();
@@ -902,7 +910,7 @@ function outputResult(dstId) {
}
}
-// Función para mostrar mensaje con Fancybox
+// Función para mostrar mensaje con alertify
function resMsg(type, txt, url, action) {
if (typeof(url) !== "undefined") {
$.ajax({ url: url, type: 'get', dataType: 'html', async: false, success: function (data) {
@@ -916,15 +924,12 @@ function resMsg(type, txt, url, action) {
switch (type) {
case "ok":
- //html = '